View source: R/replace_infinite.R
replace_infinite | R Documentation |
Replace infinite
replace_infinite(x, what = c("NaN", "Inf"), value = c(NA, NA), verbose = TRUE)
x |
vector. |
what |
What infinite values should be replaced. See details. |
value |
Value that will be used to replace selected infinite values. |
verbose |
Print warning messages. |
The function converts all NaN
and Inf
values to NA
. Input
must be a vector. Can be either what = c("NaN", "Inf")
to replace both
NaN
and Inf
or just one of the two, e.g. what = "NaN"
.
vector
vec <- c(1, 2, 3, NA, 5, NaN, Inf)
replace_infinite(vec)
replace_infinite(vec, what = "NaN", value = NA)
replace_infinite(vec, value = c(NA, 0))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.