[R] How to identify the rows in my dataframe with a negative value in any column?
Henrique Dallazuanna
wwwhsd at gmail.com
Tue Nov 24 21:04:29 CET 2009
Try this:
DF[rowSums(DF < 0) == 0,]
On Tue, Nov 24, 2009 at 5:58 PM, Mark Na <mtb954 at 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
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>
--
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O
More information about the R-help
mailing list