replace_infinite: replace_infinite

View source: R/replace_infinite.R

replace_infiniteR Documentation

replace_infinite

Description

Replace infinite

Usage

replace_infinite(x, what = c("NaN", "Inf"), value = c(NA, NA), verbose = TRUE)

Arguments

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.

Details

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".

Value

vector

Examples

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))


mhesselbarth/UtilityFunctions documentation built on Aug. 21, 2024, 8:18 a.m.