Skip to content
Prev 33570 / 398506 Next

Subseting by more than one factor...

Fernando Henrique Ferraz Pereira da Rosa <mentus at gmx.de> writes:
As Sundar pointed out it is the second form that you want.  When
intersecting conditions in subset() use &, not &&.

The way that you pasted the output in your message the column names
did not align with the columns.  I changed this in the part that I
quoted above.  This shows that you chose the wrong example, I think,
because that intersection is empty.  Try 

 subset(data, p2 == 1 & p3 == 1)

instead.