Re: [R] data.frame: return all rows where at least one...

2010-08-06 Thread werner w
Thanks for the answers! The any function was basically exactly what I was looking for. (previously I used something with rowSums() which is probably not the most efficient way.) Thanks so much, Werner -- View this message in context: http://r.789695.n4.nabble.com/data-frame-return-all-rows-w

Re: [R] data.frame: return all rows where at least one...

2010-08-06 Thread Tal Galili
One solution - let's say our data.frame is "xx" Then: xx <- matrix(rnorm(9), 3,3) apply(xx < 0, 1, any) Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostat

Re: [R] data.frame: return all rows where at least one...

2010-08-06 Thread Erik Iverson
On 08/06/2010 08:03 AM, Werner W. wrote: Hi, I know ways to do this but they all seem awkward and I somehow believe that there is a convenient shortcut. Since you don't show us what you tried, I don't know what you consider 'awkward'. If I have a data.frame with many columns, how can I re

[R] data.frame: return all rows where at least one...

2010-08-06 Thread Werner W.
Hi, I know ways to do this but they all seem awkward and I somehow believe that there is a convenient shortcut. If I have a data.frame with many columns, how can I request all rows for which at least one column satisfy an expression? For instance, all rows where at least one column is negativ