Re: [R] construct a list that consists of lists

2010-03-12 Thread Jim Lemon
On 03/12/2010 05:13 PM, Zhongyi Yuan wrote: Dear R users: I am hoping that someone can help with constructing a list that consists of list with the number of lists variable. i.e. to find a convenient express(or loop sentences) to realize the following: list( list(para1=p1, para2=p2),

Re: [R] construct a list that consists of lists

2010-03-12 Thread Zhongyi Yuan
Hi Jim, Dennis Murphy solved my problem by the following code. Thank you for you suggestion. Will check out listBuilder function too. best, Zhongyi # (2) A little more general: prespecify the number of list components # and run a one-line loop to populate the list l - vector('list', 6)

Re: [R] construct a list that consists of lists

2010-03-12 Thread Henrique Dallazuanna
You can do this also, using replicate: replicate(6, list(para1 = 1:5, para2 = 5:9), simplify = FALSE) On Fri, Mar 12, 2010 at 2:51 PM, Zhongyi Yuan zhongyi-y...@uiowa.edu wrote: Hi Jim, Dennis Murphy solved my problem by the following code. Thank you for you suggestion. Will check out

Re: [R] construct a list that consists of lists

2010-03-12 Thread Zhongyi Yuan
Hi Henrique, Great. I tried a similar thing but used list( replicate(6, list(para1 = 1:5, para2 = 5:9), simplify = FALSE) ) and didn't work. Seems I don't need list(...). Thanks. Zhongyi On Fri, Mar 12, 2010 at 11:56 AM, Henrique Dallazuanna www...@gmail.comwrote: You can do this also, using

[R] construct a list that consists of lists

2010-03-11 Thread Zhongyi Yuan
Dear R users: I am hoping that someone can help with constructing a list that consists of list with the number of lists variable. i.e. to find a convenient express(or loop sentences) to realize the following: list( list(para1=p1, para2=p2), list(para1=p1, para2=p2), , list(para1=p1,para2=p2)