defaultIfNA: Default Value if Object is NA

View source: R/default.R

defaultIfNAR Documentation

Default Value if Object is NA

Description

Return the given object or a default value if the object is NA

Usage

defaultIfNA(x, default, count = FALSE)

Arguments

x

vector possibly containing NA values

default

default value that is returned if x is NA

count

if TRUE (the default is FALSE) the number of replaced values is returned in the attributes count

Value

x if x is not NA and default otherwise

See Also

defaultIfNULL, defaultIfZero

Examples

defaultIfNA(NA, "default") # returns the default value
defaultIfNA("actual", "default") # returns the "actual" value


KWB-R/kwb.utils documentation built on April 1, 2024, 7:12 a.m.