View source: R/replace_nan_inf.R
replace_nan_inf | R Documentation |
NaN
values into NA
Replaces all infinite (Inf
and -Inf
) or NaN
values with NA
.
replace_nan_inf(x, ...)
x |
A vector or a dataframe |
... |
Currently not used. |
Data with Inf
, -Inf
, and NaN
converted to NA
.
# a vector
x <- c(1, 2, NA, 3, NaN, 4, NA, 5, Inf, -Inf, 6, 7)
replace_nan_inf(x)
# a data frame
df <- data.frame(
x = c(1, NA, 5, Inf, 2, NA),
y = c(3, NaN, 4, -Inf, 6, 7),
stringsAsFactors = FALSE
)
replace_nan_inf(df)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.