Re: [R] group length

From: Ledon, Alain <Alain.Ledon_at_ally.com>
Date: Thu, 12 May 2011 13:00:42 -0400

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

-----Original Message-----
From: r-help-bounces_at_r-project.org [mailto:r-help-bounces_at_r-project.org] On Behalf Of Asan Ramzan Sent: Thursday, May 12, 2011 12:50 PM
To: r-help_at_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 made up example below?
 
>function(length(y1:y2)
[1] 3 4 4 2

        [[alternative HTML version deleted]]



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu 12 May 2011 - 17:23:44 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 12 May 2011 - 18:00:06 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive