- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试将具有 3 列的 CSV 转换为弧图。列 - A
, B
, C
总是按顺序走 A
-> B
-> C
.但是,我没有看到将其作为弧线图来实现的方法,因为似乎大多数方法都使用了两列边缘图。因此,我一直在遵循说明 here转换为邻接矩阵。
我将重新创建下面的问题 - 但不会生成虚假数据,因为一个问题是可能无法正确读取 CSV。
基本上,CSV 包含行,其中每列由 ,
分隔。但可能包含多个由 ;
分隔的值如:
ENV;MO,echoic;tact,social
ENV;MO,mand,physical
OVB,intraverbal,social
ENV;OVB,tact,social
OVB,intraverbal;tact,social
OVB;ENV;MO,intraverbal;mand,social
OVB;ENV;MO,intraverbal;mand,physical;social
ENV;MO,mand,social;physical
options(stringsAsFactors = F)
lst <- read.csv("abc.csv", header=FALSE)
#this is pretty much straight from the link above
d <- do.call(rbind, lst)
edges <- rbind(d[ ,1:2], d[ ,2:3])
g <- graph.data.frame(edges, directed=TRUE)
adj <- as.matrix(get.adjacency(g))
g2 <- new("graphAM", adjMat=adj, edgemode="directed")
plot(g2, attrs = list(graph = list(rankdir="LR"), node = list(fillcolor = "lightblue")))
A
的元素指向
B
指向
C
.相反,它只是 A 指向自身的一个元素;来自
B
指向另一个指向另一个,例如,
intraverbal
->
mand
->
intraverbal
;
tact
,还有一个来自
C
指向自身和来自
C
的另一个值.
A
->
B
->
C
格式,一行,如
OVB;ENV;MO,intraverbal;mand,social
A(OVB&ENV&MO) -> B(intraverbal&mand) -> C(social)
最佳答案
不确定这是否是你想要的。不过你可以试试:
require(igraph)
df[]<-lapply(df,strsplit,";")
el<-as.matrix(do.call(rbind,apply(df,1,expand.grid)))
g<-graph_from_edgelist(rbind(el[,-3],el[,-1]))
plot(g)
df<-structure(list(V1 = c("ENV;MO", "ENV;MO", "OVB", "ENV;OVB", "OVB",
"OVB;ENV;MO", "OVB;ENV;MO", "ENV;MO"), V2 = c("echoic;tact",
"mand", "intraverbal", "tact", "intraverbal;tact", "intraverbal;mand",
"intraverbal;mand", "mand"), V3 = c("social", "physical", "social",
"social", "social", "social", "physical;social", "social;physical"
)), .Names = c("V1", "V2", "V3"), row.names = c(NA, -8L), class = "data.frame")
关于r - 3 列 CSV,到邻接矩阵,到网络图,到 Arcplot,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37243743/
我在 ma 应用程序中使用 Jqgrid 树 View 模型,我可以看到它显示错误,因为不支持对象或属性我已经包含了 grid.Treeview.js 和其他 Jqgrid 脚本文件。我不知道可能是什
我正在尝试使用图中所示的符号在 matlab 上实现 Freeman Chain Code [4 adjacency]: 我的代码为我测试过的多个小矩阵提供了正确的链码。但是,当我在我的实际图像文件上
我有一张表,其中包含世界上所有地理位置及其关系的位置。 这是一个显示层次结构的示例。你会看到数据实际上存储为所有三个 枚举路径 邻接表 嵌套集 数据显然也不会改变。下面是英格兰布莱顿位置的直系祖先示例
我正在尝试从邻接树模型(id、parent_id)中的 MySQL 数据库中计算/创建或生成 PHP 目录。到目前为止,这是我在回显输出时所取得的成就。 1. Category 1 1 Subc
我知道 std::vector在内部连续存储它的数据(除非它是 std::vector )都在旧的 C++03 中标准和新的C++11 . 处理此问题并引用标准的好 stackoverflow 问题:
Development language and DB: PHP/MySQL 我有一张 geo_places 表,其中包含大约 800 万个地理位置。 这些地方都是分层次的,我用 parent_id
过去几个小时我一直在尝试在网上找到这个问题的解决方案。我找到了很多关于如何从嵌套集合转换为邻接的例子......但很少有相反的例子。我发现的示例要么不起作用,要么使用 MySQL 过程。不幸的是,我不
我是一名优秀的程序员,十分优秀!