我试图将矢量指定为顶点的属性,但没有任何运气:
# assignment of a numeric value (everything is ok)
g<-set.vertex.attribute(g, 'checked', 2, 3)
V(g)$checked
.
# assignment of a vector (is not working)
g<-set.vertex.attribute(g, 'checked', 2, c(3, 1))
V(g)$checked
检查手册,http://igraph.sourceforge.net/doc/R/attributes.html看起来这是不可能的 . 有没有解决方法?
到目前为止,我想出的唯一的事情是:
存储这个
-
另一个结构中的信息
-
将向量转换为带分隔符的字符串并存储为字符串
1 回答
这很好用:
EDIT 为什么会这样?当你使用:
你得到这个警告:
实际上,您尝试将c(3,1)中的 length = 2置于长度= 1的变量中 . 所以想法是用类似的东西替换c(3,1),但长度= 1 . 例如: