ez.nan2na | R Documentation |
NA
s in array-like objects.Replaces non-finite values (Inf, -Inf, NaN, NA) with NA
s in array-like objects.
ez.nan2na(x)
x |
An array-like object, or vector |
Returns x
with non-finite values (Inf, -Inf, NaN, NA) replaced with NA
s.
is.na() returns TRUE for both NA and NaN, however is.nan() return TRUE for NaN (0/0) and FALSE for NA.
mean(c(NA,NA),na.rm=T) —> NaN, mean(c(NA,NA),na.rm=F) —> NA sum(c(NA,NA),na.rm=T) —> 0, sum(c(NA,NA),na.rm=F) —> NA
is.finite
, NA
ez.nan2na(Inf)
ez.nan2na(rep(c(0, -Inf, Inf, NA, NaN), 3))
ez.nan2na(matrix(c(0, Inf, -Inf, 0), 2, 2))
ez.nan2na(array(c(0, -Inf, Inf, 1, NaN), dim = c(2, 3, 4)))
ez.nan2na(ts(rep(c(0, -Inf, Inf), 2), frequency = 5))
ez.nan2na(factor(c('ab','de'))), ez.nan2na(c('ab','de')) # returns the original
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.