replace_non_finite: Replace Non-Finite Data

View source: R/replace_non_finite.R

replace_non_finiteR 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 magpie object.

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)


magclass documentation built on May 29, 2024, 6:20 a.m.