Re: [R] Creating a list of empty lists

2009-10-14 Thread Magnus Torfason
On 10/13/2009 10:06 AM, Henrique Dallazuanna wrote: Try this: replicate(3, list()) Thanks! I now have three ways to achieve my goal: 1: rep(list(list()), 3) 2: replicate(3, list()) 3: Due to the way R recycles arguments, I found that it is enough to have construct a list(list()), and then

Re: [R] Creating a list of empty lists

2009-10-13 Thread Henrique Dallazuanna
Try this: replicate(3, list()) On Tue, Oct 13, 2009 at 10:48 AM, Magnus Torfason wrote: > 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(lis

Re: [R] Creating a list of empty lists

2009-10-13 Thread Magnus Torfason
Live and learn ... Thank you! On 10/13/2009 9:57 AM, Romain Francois wrote: On 10/13/2009 03:48 PM, Magnus Torfason wrote: l = list(list()) for ( i in sequence(length-1) ) { l = list(unlist(l,recursive=FALSE), list()) } About this : > rep( list(list()), 3 ) [[1]] li

Re: [R] Creating a list of empty lists

2009-10-13 Thread Romain Francois
On 10/13/2009 03:48 PM, Magnus Torfason wrote: l = list(list()) for ( i in sequence(length-1) ) { l = list(unlist(l,recursive=FALSE), list()) } About this : > rep( list(list()), 3 ) [[1]] list() [[2]] list() [[3]] list() Romain -- Romain Francois Professional R Enth

[R] Creating a list of empty lists

2009-10-13 Thread Magnus Torfason
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(