[R] Equality of Vectors

Downey, Patrick PDowney at urban.org
Fri Aug 13 20:49:04 CEST 2010


Hello,

Is there a way to get a single TRUE or FALSE statement from comparing two
vectors? For example, 
c(1,2,3) == c(1,2,3)
produces 
TRUE TRUE TRUE

where I would like it to produce only
TRUE 
for use in an if statement.

Likewise, when two vectors are not exactly identical (in all elements) I
would like a single FALSE result, as opposed to
c(1,2,3) == c(1,2,5)
TRUE TRUE FALSE

Any ideas?

Thanks,
Mitch



More information about the R-help mailing list