Learn R Programming

rtemis (version 0.79)

ifNotNull: Say No to NULL

Description

Returns the input, unless it is NULL, in which case it returns an empty vector / list, etc of defined type

Usage

ifNotNull(x, defType)

Arguments

x

Input of any type, may be NULL

defType

If x is NULL, return empty vector of this type. Options: list, numeric, character, integer

Details

This can be useful when creating S4, RC, or R6 objects