replace_non_finite {magclass} | R Documentation |
Replace Non-Finite Data
Description
Replaces all instances of non-finite data (NA
, NaN
, Inf
, and -Inf
).
Usage
replace_non_finite(x, replace = 0)
Arguments
x |
A vector or |
replace |
A value to replace non-finite data with. |
Value
A vector or magpie
object, same as x
.
Author(s)
Michaja Pehl
Examples
part <- new.magpie(letters[1:3], years = 'y1995', names = 'foo')
total <- new.magpie(letters[1:3], years = 'y1995', names = 'foo')
part[,,] <- c(0, 1, 2)
total[,,] <- c(0, 10, 10)
part / total
replace_non_finite(part / total)
[Package magclass version 6.13.2 Index]