Re: [R] group length

2011-05-12 Thread Jeffrey Dick
On Thu, May 12, 2011 at 10:00 AM, Ledon, Alain wrote: > sapply... > >> y1=c(1.214,1.180,1.199) >> y2=c(1.614,1.710,1.867,1.479) >> y3=c(1.361,1.270,1.375,1.299) >> y4=c(1.459,1.335) >> sapply(list(y1,y2,y3,y4), length) > [1] 3 4 4 2 > Or, if you don't want to name each object individually: > sap

Re: [R] group length

2011-05-12 Thread Ledon, Alain
Of Asan Ramzan Sent: Thursday, May 12, 2011 12:50 PM To: r-help@r-project.org Subject: [R] group length Hi   I have four groups   y1=c(1.214,1.180,1.199) y2=c(1.614,1.710,1.867,1.479) y3=c(1.361,1.270,1.375,1.299) y4=c(1.459,1.335) Is there a function that can give me the length for each, like the m

Re: [R] group length

2011-05-12 Thread Scott Chamberlain
require(plyr) laply(list(y1, y2, y3, y4), length) Scott On Thursday, May 12, 2011 at 11:50 AM, Asan Ramzan wrote: Hi > > I have four groups > > y1=c(1.214,1.180,1.199) > y2=c(1.614,1.710,1.867,1.479) > y3=c(1.361,1.270,1.375,1.299) > y4=c(1.459,1.335) > Is there a function that can give me the

[R] group length

2011-05-12 Thread Asan Ramzan
Hi   I have four groups   y1=c(1.214,1.180,1.199) y2=c(1.614,1.710,1.867,1.479) y3=c(1.361,1.270,1.375,1.299) y4=c(1.459,1.335) Is there a function that can give me the length for each, like the made up example below?   >function(length(y1:y2) [1] 3 4 4 2 [[alternative HTML version deleted