Re: [R] Creating list with increasing string lengths

2015-06-14 Thread Jim Lemon
Hi Nia, Many ways to do something like this, for example: N<-6 sapply(1:N,function(x) return(sample(1:10,x,TRUE))) I'll let you work out how to generalize this. Jim On Sun, Jun 14, 2015 at 3:06 PM, Bert Gunter wrote: > Is this homework? Homework is deprecated here. > > ?lapply > > is one of m

Re: [R] Creating list with increasing string lengths

2015-06-13 Thread Bert Gunter
Is this homework? Homework is deprecated here. ?lapply is one of many possible approaches. If this is not homework, showing your unsuccessful code would likely lead to a better learning experience for you. Cheers, Bert Bert Gunter "Data is not information. Information is not knowledge. And kno

[R] Creating list with increasing string lengths

2015-06-13 Thread Nia Gupta via R-help
Hello, I am trying to create a list where each name would have an increasing vector length. For example, I am trying to obtain something that looks like this: [[1]][1] 2 [[2]] [1] 2 4 [[3]] [1] 1 2 3 . The numbers generated would just be any random numbers. My thought was to use a fo