Question: Set multiple attributes to one node in R
0
gravatar for Vania
5 months 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 • 306 views
ADD COMMENTlink modified 5 months ago by Jean-Karim Heriche15k • written 5 months 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 5 months ago by venu5.0k

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

ADD REPLYlink written 5 months ago by Jean-Karim Heriche15k

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

ADD REPLYlink written 5 months ago by venu5.0k
3
gravatar for Jean-Karim Heriche
5 months ago by
EMBL Heidelberg, Germany
Jean-Karim Heriche15k 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 5 months ago by Jean-Karim Heriche15k

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 5 months ago • written 5 months 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: 750 users visited in the last hour