On Wed, Apr 6, 2011 at 3:09 PM, Laura Smith <smithlaura...@gmail.com> wrote: > Hi! > > In a function, I may have an instance in which all elements are equal. > >> x <- rep(1,5) >> >> x > [1] 1 1 1 1 1 >> identical(x) > Error in .Internal(identical(x, y, num.eq, single.NA, attrib.as.set)) : > 'y' is missing >> all.equal(x) > Error in is.expression(x) : 'x' is missing >>
all looks at a logical vector (or two), and all.equal compares two objects. For your purposes, you can ask whether all (x==x[1]) for example. Peter ______________________________________________ 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.