Re: [R] variable length lisin in data frame

2014-05-12 Thread MacQueen, Don
I think it will depend on how you plan to use the data. Again in my opinion, I think the simplest most natural storage structure in the context of R would be a nested list: mydat - list( list(contacts=c(3,4), ncon=2), list(contacts=c(1,3,4), ncon=3), list(contacts=c(4,2,1), ncon=3),

[R] variable length lisin in data frame

2014-05-10 Thread Ragia Ibrahim
Dear Group, I have data like the following id contacts_list number of contacts --- 1 3 4 2 2 1 3 43 34 2 1 3 411

Re: [R] variable length lisin in data frame

2014-05-10 Thread Duncan Murdoch
On 10/05/2014, 7:46 AM, Ragia Ibrahim wrote: Dear Group, I have data like the following id contacts_list number of contacts --- 1 3 4 2 2 1 3 43 34 2 1

Re: [R] variable length lisin in data frame

2014-05-10 Thread arun
Hi, Try:  dat - data.frame(id=1:4, contacts_list=I(list(3:4,c(1,3,4), c(4,2,1), 1)), `number of contacts`=c(2,3,3,1),check.names=FALSE) attr(dat$contacts_list,class) - NULL #if needed  dat A.K. Dear Group, I have data like the following id   contacts_list   number of contacts

Re: [R] variable length lisin in data frame

2014-05-10 Thread William Dunlap
d - data.frame(id=1:4, no.contacts=c(2,3,3,1)) d$contacts_list - list(3:4, c(1,3,4), c(4,2,1), 1 ) If you store that information in a longer format, with each row being an edge to the relationship graph, it can make further processing easier: d2 - with(d, data.frame(id=rep(id,