Learn R Programming

magclass (version 6.13.2)

replace_non_finite: Replace Non-Finite Data

Description

Replaces all instances of non-finite data (NA, NaN, Inf, and -Inf).

Usage

replace_non_finite(x, replace = 0)

Value

A vector or magpie object, same as x.

Arguments

x

A vector or magpie object.

replace

A value to replace non-finite data with.

Author

Michaja Pehl

Examples

Run this code
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)

Run the code above in your browser using DataLab