Re: [R] subsetting a list of dataframes

From: Rolf Turner <rolf.turner_at_xtra.co.nz>
Date: Wed, 18 May 2011 08:39:48 +1200

On 18/05/11 08:24, Lara Poplarski wrote:
> Hello All,
>
> I have a list of dataframes, and I need to subset it by keeping only those
> dataframes in the list that meet a certain criterion. Specifically, I need
> to generate a second list which only includes those dataframes whose number
> of rows is> 1.
>
> Could someone suggest how to do this? I have come close to what I need with
> loops and such, but there must be a less clumsy way...

    L.new <- L[tapply(L,nrow) > 1]

     cheers,

         Rolf Turner



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 Tue 17 May 2011 - 20:43:48 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 Tue 17 May 2011 - 20:50: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