Patrick, See all(). For example,
> all(c(1,2,3)==c(1,2,3)) [1] TRUE > all(c(1,2,3)==c(2,1,3)) [1] FALSE > -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of Downey, Patrick > Sent: Friday, August 13, 2010 1:49 PM > To: r-help@r-project.org > Subject: [R] Equality of Vectors > > 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. ______________________________________________ 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.