Hello everyone,

I need some help with lists inside lists (a good way to emulate a struct)\

Assume that there is a small list called fred:
fred <- list(happy = 1:10, name = "squash")


and a big list called bigfred that includes fred list 5 times
bigfred <- rep(fred,5)

Is it possible somehow to index all these sublists(fred) inside bigfred with a 
more direct way like this:
bigfred[1] shows the first sublist fred
bigfred[2][2] shows the second sublist fred, the second element of the fred list

So far I found some way to do this by refering to the sublists by the following:
bigfred[1+index*length(fred)]
where index shows the beginning of a sublist.

I would like to thank you in advance for your help
Best Regards
Alex



      
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to