Skip to content

test individual values in rows

4 messages · Iain Gallagher, Gábor Csárdi, Erik Iverson

#
keep <- apply( DATA, 1, min ) >= 100
DATA <- DATA[ keep, ]

See ?apply for more.

Gabor
On Fri, Mar 14, 2008 at 01:26:49PM +0000, IAIN GALLAGHER wrote:

  
    
#
If your data.frame is completely numeric, this is easy.

If your data.frame is called df, then do

df[apply(df, 1, function(x) !all(x < 100)),]

Look at ?apply

Best,
Erik Iverson
IAIN GALLAGHER wrote:
#
Of course, it might be clearer if instead of

!all(x < 100) I had put, any(x > 100)
Erik Iverson wrote: