[R] group length
Jeffrey Dick
j3ffdick at gmail.com
Thu May 12 19:40:04 CEST 2011
On Thu, May 12, 2011 at 10:00 AM, Ledon, Alain <Alain.Ledon at ally.com> 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:
> sapply(mget(paste("y",1:4,sep=""),sys.frame()),length)
y1 y2 y3 y4
3 4 4 2
More information about the R-help
mailing list