Re: [R] Equality of Vectors

2010-08-13 Thread Dimitris Rizopoulos
have a look at function all() but also at function all.equal() -- for your example, x1 <- c(1,2,3) x2 <- c(1,2,3) x3 <- c(1,2,5) all(x1 == x2) all(x1 == x3) # this safer isTRUE(all.equal(x1, x2)) isTRUE(all.equal(x1, x3)) I hope it helps. Best, Dimitris On 8/13/2010 8:49 PM, Downey, Patri

Re: [R] Equality of Vectors

2010-08-13 Thread Henrique Dallazuanna
all(c(1, 2, 3) %in% c(1,2,3)) On Fri, Aug 13, 2010 at 3:49 PM, 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

Re: [R] Equality of Vectors

2010-08-13 Thread Derek Ogle
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 li

Re: [R] Equality of Vectors

2010-08-13 Thread Jorge Ivan Velez
Hi Mitch, How about identical()? > identical(c(1,2,3), c(1,2,5)) [1] FALSE > identical(c(1,2,3), c(1,2,3)) [1] TRUE See ?identical and ?all.equal for more information. HTH, Jorge On Fri, Aug 13, 2010 at 2:49 PM, Downey, Patrick <> wrote: > Hello, > > Is there a way to get a single TRUE or FA

Re: [R] Equality of Vectors

2010-08-13 Thread Phil Spector
?all - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley spec.

Re: [R] Equality of Vectors

2010-08-13 Thread Nikhil Kaza
?all nikhil.l...@gmail.com On Aug 13, 2010, at 2:49 PM, Downey, Patrick wrote: c(1,2,3) == c(1,2,3) __ 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

[R] Equality of Vectors

2010-08-13 Thread Downey, Patrick
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 w