num.ident {cwhmisc} | R Documentation |
Check two variables on numerical identity or whether both are either NaN or NA.
num.ident(x,y)
x, y |
Variables to check for identity, may be arrays. |
TRUE or FALSE
No check is made whether x
or y
are numeric
Christian W. Hoffmann <c-w.hoffmann@sunrise.ch>
http://www.wsl.ch/personal_homepages/hoffmann/index_EN
xxxx <- c(100,-1e-13,Inf,-Inf, NaN, pi, NA) names(xxxx) <- formatC(xxxx, dig=3) (aaaa <- outer(xxxx,xxxx,function(x,y) num.ident(x,y))) all((aaaa & !is.na(aaaa)) == (row(aaaa) == col(aaaa))) # aaaa has TRUE only on the diagonal, i.e. identity works correctly