valueOrDefault: Check if x is null. If so, return defaultValue, otherwise run...

View source: R/mz_tab_utils.R

valueOrDefaultR Documentation

Check if x is null. If so, return defaultValue, otherwise run function on x and return the result. If a value x is encountered that is NULL, and nullable is set to FALSE, execution will be stopped and an error message will be printed.

Description

Check if x is null. If so, return defaultValue, otherwise run function on x and return the result. If a value x is encountered that is NULL, and nullable is set to FALSE, execution will be stopped and an error message will be printed.

Usage

valueOrDefault(x, FUN = identity, nullable = TRUE, defaultValue = "null", ...)

Arguments

x

the argument to create a value for.

FUN

the function to apply to x, if x is not NULL.

nullable

if TRUE, NULL is a valid value, otherwise, an error will be raised.

defaultValue

the value to return, if x is NULL.

...

arguments that will be passed on to FUN.


lifs-tools/rmzTab-m documentation built on Jan. 26, 2023, 4:45 p.m.