R gotcha: logical-and operator for combining conditions is & not &&

Viewed 23933

Why doesn't subset() work with a logical and && operator combining two conditions?

> subset(tt, (customer_id==177 && visit_date=="2010-08-26"))
<0 rows> (or 0-length row.names)

but they each work individually:

> subset(tt, customer_id==177)

> subset(tt, visit_date=="2010-08-26")

(Want to avoid using large temporary variables - my dataset is huge)

2 Answers
Related