Skip to content
Prev 284177 / 398502 Next

combining data structures

Not entirely sure why you would want a data.frame that has multiple entries
in one of the columns (Connect.down) but leaving that aside is the following
of any use?

nn=list()
    
nn[[1]] =  list(Node = "1", Connect.up = c(NULL), Connect.down = c(2,3))
nn[[2]] =  list(Node = "2", Connect.up = c(1), Connect.down = c(4,5))
nn[[3]] =  list(Node = "3", Connect.up = c(NULL), Connect.down = c(2,3))
nn[[4]] =  list(Node = "4", Connect.up = c(1), Connect.down = c(4,5))

Output = do.call(as.data.frame(rbind),nn)

# Output
  value.Node value.Connect.up value.Connect.down
1          1             NULL               2, 3
2          2                1               4, 5
3          3             NULL               2, 3
4          4                1               4, 5

HTH

Pete



dkStevens wrote
--
View this message in context: http://r.789695.n4.nabble.com/combining-data-structures-tp4356288p4356547.html
Sent from the R help mailing list archive at Nabble.com.