David
1. The last line of the code should have been ...
Output = as.data.frame(do.call(rbind,nn))
# Output
Node Connect.up Connect.down
11 NULL 2, 3
22 1 4, 5
33 NULL 2, 3
44 1 4, 5
Apologies for any confusion
2.
Thanks for the reply. Two things - I must have something missing because
copying and pasting your example gave me an error
... your definitions of nn
Output = do.call(as.data.frame(rbind),nn)
Error in as.data.frame.default(rbind) :
cannot coerce class '"function"' into a data.frame
The se
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)
Group
It's unlikely I'm trying this the best way, but I'm trying to create a
data structure from elements like
nNode = 2
nn = vector("list",nNode)
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))
4 matches
Mail list logo