Learn R Programming

hgutils (version 0.2.19)

default: Default value

Description

Returns a default value for a scalar, to be used when the input is NA, NULL or has a length of 0.

Usage

default(x, default_value)

Value

The value of x when x is not NA, NULL or has a length of 0, and default_value otherwise.

Arguments

x

A value

default_value

The replacement value for when x is NA, NULL or has a length of 0.

Examples

Run this code
default(NA, 0)

Run the code above in your browser using DataLab