Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

num.ident

Check numerical values for identity


Description

Check two variables on numerical identity or whether both are either NaN or NA.

Usage

num.ident(x,y)

Arguments

x, y

Variables to check for identity, may be arrays.

Value

Note

No check is made whether x or y are numeric

Author(s)

Christian W. Hoffmann <christian@echoffmann.ch>

Examples

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

cwhmisc

Miscellaneous Functions for Math, Plotting, Printing, Statistics, Strings, and Tools

v6.6
GPL (>= 2)
Authors
Christian W. Hoffmann
Initial release
2018-08-24, 10:40:10

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.