Thanks a a lot, Jose!

On Tue, Jul 30, 2013 at 10:19 AM, José María Mateos <jmmat...@mce.hggm.es>wrote:

> 2013/7/30 Dimitri Liakhovitski <dimitri.liakhovit...@gmail.com>:
> > How can I grab only those rows that don't contain any -1s (no matter in
> > what columns? Without writing a loop.
> > In other words, I want my output to contain only rows 3 and 5 of x.
>
> index <- apply(x, 1, function (x) { !(c(-1) %in% x)})
> x[index, ]
>   a b c d e
> 3 2 3 3 4 3
> 5 4 5 5 6 4
>
> Best,
>
> José.
>



-- 
Dimitri Liakhovitski

        [[alternative HTML version deleted]]

______________________________________________
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