defaultIfNULL: Default Value if Object is NULL

View source: R/default.R

defaultIfNULLR Documentation

Default Value if Object is NULL

Description

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

Usage

defaultIfNULL(x, default, count = FALSE)

Arguments

x

R object to be checked for NULL

default

default value that is returned if x is NULL

count

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

Value

x if x is not NULL and default otherwise

See Also

defaultIfNA, defaultIfZero

Examples

defaultIfNULL(NULL, "default") # returns the default value
defaultIfNULL("actual", "default") # returns the "actual" value
  

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