On 01/10/2014 23:54, Peter Alspach wrote:
Tena koe Kate

If kateDF is a data.frame with your data, then

apply(kateDF, 1, function(x) isTRUE(all.equal(x[2], x[1], check.attributes = 
FALSE, tolerance=0.1)))

comes close to (what I think) you want (but not to what you have illustrated in 
your 'eventual outcome').  Anyhow, it may be enough to allow you to get there.

HTH ....

Peter Alspach


I seem to need to specify all.equal(..., scale) to get correct values for some data/tolerances:
--------------
aDF <- data.frame(a = 1:10, b=10:1)

apply(aDF, 1, function(x)
isTRUE(all.equal(x[2], x[1], check.attributes = FALSE, tolerance = 5, scale = 1))
  )
#  [1] FALSE FALSE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE FALSE FALSE
apply(aDF, 1, function(x)
  isTRUE(all.equal(x[2], x[1], check.attributes = FALSE, tolerance = 5))
)
#  [1]  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE FALSE FALSE
----------------------
I'm probably being stupid, but from reading ?all.equal I would have expected scale = 1 and the default scale = NULL to give identical results for the length one numerics being passed to all.equal.

Can anyone explain?

KJ

______________________________________________
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.

Reply via email to