[R] Equality of Vectors

Phil Spector spector at stat.berkeley.edu
Fri Aug 13 20:52:09 CEST 2010


?all

 					- Phil Spector
 					 Statistical Computing Facility
 					 Department of Statistics
 					 UC Berkeley
 					 spector at stat.berkeley.edu


On Fri, 13 Aug 2010, Downey, Patrick wrote:

> 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
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list