Skip to content
Prev 201488 / 398502 Next

How to identify the rows in my dataframe with a negative value in any column?

On Nov 24, 2009, at 3:04 PM, Henrique Dallazuanna wrote:

            
ITYM:
  > DF <- data.frame(a=1:10, b=c(1:3,-4, 5:10), c=c(-1, 2:10))
 >
 > DF[rowSums(DF < 0)  > 0,]
   a  b  c
1 1  1 -1
4 4 -4  4

--  
David
David Winsemius, MD
Heritage Laboratories
West Hartford, CT