dropNA | R Documentation |
dropNA
returns the vector 'x', without elements that are NA or NaN
or, if 'inf' is TRUE, equal to Inf or -Inf.
replaceNA
replaces these values by values from the second argument
dropNA(x, inf = TRUE)
replaceNA(x, na, inf = TRUE)
x |
vector from which the non-real values should be dropped or replaced |
na |
replacement or vector from which the replacing values are taken. |
inf |
logical: should 'Inf' and '-Inf' be considered "non-real"? |
For dropNA
: Vector containing the 'real' values
of 'x' only
For replaceNA
: Vector with 'non-real' values replaced by
the respective elements of na
.
The differences to 'na.omit(x)' are: 'Inf' and '-Inf' are also dropped, unless 'inf==FALSE'.\ no attribute 'na.action' is appended.
Werner A. Stahel
na.omit, sumNA, ifelse
dd <- c(1, NA, 0/0, 4, -1/0, 6)
dropNA(dd)
na.omit(dd)
replaceNA(dd, 99)
replaceNA(dd, 100+1:6)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.