Question: Set multiple attributes to one node in R
0
gravatar for Vania
11 weeks ago by
Vania10
Vania10 wrote:

I am using igraph to construct a networks. But I have a doubt, I have nodes with 3 different attributes (On, Off and Unknown). For example:

N1  ON
N1  OFF
N2  UNKNOWN
N2  ON
N2  OFF

How can I set the three different attributes in the same node?

igraph R • 201 views
ADD COMMENTlink modified 11 weeks ago by Jean-Karim Heriche14k • written 11 weeks ago by Vania10

Something like this ?

library(igraph)
df=read.table("bio.txt", header=FALSE)
g=graph_from_data_frame(df)
plot(g)

Check igraph docs to modify network.

ADD REPLYlink written 11 weeks ago by venu4.6k

I don't think this answer the question. As I understand it, OP wants to have multiple values as an attribute.

ADD REPLYlink written 11 weeks ago by Jean-Karim Heriche14k

I was also little skeptical about my understanding about the question (hence the ?).

ADD REPLYlink written 11 weeks ago by venu4.6k
3
gravatar for Jean-Karim Heriche
11 weeks ago by
EMBL Heidelberg, Germany
Jean-Karim Heriche14k wrote:

You can use a vector as an attribute, something like:

g <- set.vertex.attribute(g, 'status', "N2", list(c("ON", "OFF", "UNKNOWN")))
ADD COMMENTlink written 11 weeks ago by Jean-Karim Heriche14k

This is exactly what I was looking for. Thank you so much and sorry for my bad redaction, I am new in this site.

ADD REPLYlink modified 11 weeks ago • written 11 weeks ago by Vania10
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 821 users visited in the last hour