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

Try this:

DF[rowSums(DF < 0) == 0,]

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

On Tue, Nov 24, 2009 at 5:58 PM, Mark Na <mtb...@gmail.com> wrote:
Dear R-helpers,

I have a dataframe that should not contain any negative values, but it does. I wish to print the rows from my dataframe that contain a negative value in
any column. I've tried this:

dataframe[dataframe<0,]

but it just returns a row of NAs.

I would very much appreciate any help with this you could provide.

Thanks, Mark

David Winsemius, MD
Heritage Laboratories
West Hartford, CT

______________________________________________
R-help@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.

Reply via email to