Learn R Programming

mcmodule (version 1.1.1)

mcnode_na_rm: Replace NA and Infinite Values in mcnode Objects

Description

Replaces NA and infinite values in mcnode objects with a specified value.

Usage

mcnode_na_rm(mcnode, na_value = 0)

Value

An mcnode object with NA and infinite values replaced by na_value

Arguments

mcnode

An mcnode object containing NA or infinite values

na_value

Numeric value to replace NA and infinite values (default = 0)

See Also

is.na.mcnode

Examples

Run this code
sample_mcnode <- mcstoc(runif,
               min = mcdata(c(NA, 0.2, -Inf), type = "0", nvariates = 3),
               max = mcdata(c(NA, 0.3, Inf), type = "0", nvariates = 3),
               nvariates = 3
)
# Replace NA and Inf with 0
clean_mcnode <- mcnode_na_rm(sample_mcnode)

Run the code above in your browser using DataLab