Re: [R] Loop on characters

2009-02-11 Thread Phil Spector
megh - The best way to organize similar objects in R is to put them into a list. If you keep this in mind when you're first organizing your data, it's no harder than giving each object a separate name. For example l = list(l1,l2,l3) The reason that this is a good idea in R is that functio

Re: [R] Loop on characters

2009-02-10 Thread jdeisenberg
megh wrote: > > suppose I have three vectors like : > > l1 = 1:4 > l2 = 4:9 > l3 = 16:67 > > now I want to construct a loop like : > > for (i in 1:3) >{ > count1[i] = length(li) # i.e. it will take l1, l2, l3 according to > value of i >} > Try this. There's probably a more ele

[R] Loop on characters

2009-02-10 Thread megh
Hi, suppose I have three vectors like : l1 = 1:4 l2 = 4:9 l3 = 16:67 now I want to construct a loop like : for (i in 1:3) { count1[i] = length(li) # i.e. it will take l1, l2, l3 according to value of i } Can anyone please tell me how to do that? Regards, -- View this message in