[R] Creating a list of empty lists
Magnus Torfason
zulutime.net at gmail.com
Tue Oct 13 15:48:46 CEST 2009
Well here is one more brain-teaser related to assigning stuff into a
list of list. What if I need to create a new list of empty lists? I have
actually got a solution to this problem:
l = list(list())
for ( i in sequence(length-1) )
{
l = list(unlist(l,recursive=FALSE), list())
}
But it is not very neat to do this in a loop. Are there any cuter ways
to do this?
Best,
Magnus
More information about the R-help
mailing list