Give default value if doesn't exist

default(x, default, rm_na = TRUE)

Arguments

x

The value to test if it exists

default

The default value

rm_na

Replace NA values with the default

Value

the value or default

Examples

a <- 1 default(a, 2) # should return 1
#> [1] 1
remove(a) default(a, 2) # should return 2
#> [1] 2