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 second is the need, and why I'm not sure this is the best way. This
is to customize the flow charting library code from the library
'diagram' to use a node-and-link characterization of a network - think
PERT charts or perhaps linking river segments in a water quality model.
Each Node will be a, say, circle and has attributes of being connected
up to one or more upstream nodes and down to one or more downstream
nodes. So the Connect.up column is a vector up upstream connections,
usually one but sometimes > one, and likewise Connect.down. There is an
accompanying table of links with attributes of which nodes are at each
end of a link and other metadata that describe the link (e.g. the length
of time required to traverse the link, its name etc. That said, my
thought was that the situation was too simple to fire up a full-blown
object system beyond what R provides natively. I guess it's like making
a data frame that has some 3-d elements.
On 2/3/2012 9:32 PM, Pete Brecknock wrote:
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)
--
David K Stevens, P.E., Ph.D., Professor
Civil and Environmental Engineering
Utah Water Research Laboratory
8200 Old Main Hill
Logan, UT 84322-8200
435 797 3229 - voice
435 797 1363 - fax
david.stevens@
[[alternative HTML version deleted]]