all(c(1, 2, 3) %in% c(1,2,3))

On Fri, Aug 13, 2010 at 3:49 PM, Downey, Patrick <PDowney@urban.org> 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@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.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

	[[alternative HTML version deleted]]

