Skip to content
Back to formatted view

Raw Message

Message-ID: <4DD2DD14.60200@xtra.co.nz>
Date: 2011-05-17T20:39:48Z
From: Rolf Turner
Subject: subsetting a list of dataframes
In-Reply-To: <BANLkTimS73dDE5gCWyY=zxkM03Dpf+3Dew@mail.gmail.com>

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