[R] logical operators in 'subset'

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Thu Nov 13 19:47:03 CET 2008


2008/11/13 Reitsma, Rene - COB <reitsmar at bus.oregonstate.edu>:

>>subset(foo, c1 > 1 && c2 > 5)
> [1] c1 c2 c3
> <0 rows> (or 0-length row.names)

 Too many ampersands:

> subset(foo, c1 > 1 & c2 > 5)
   c1 c2 c3
r3  3  6  9

See help("&")

Barry



More information about the R-help mailing list