vec_null: Handle Null Values for Text to Vector Conversion

View source: R/ui_to_server.R

vec_nullR Documentation

Handle Null Values for Text to Vector Conversion

Description

Handle Null Values for Text to Vector Conversion

Usage

vec_null(par_input = "", alt_na = NULL)

Arguments

par_input

A string input, default is "".

alt_na

If alt_na is not set to NULL (the default), then it is an alternative string used to represent NA. Usually, this is a string such as "NA", "NaN", etc.

Value

NULL if input is NA, if input is empty, or if input is alt_na (and alt_na is not NULL). Otherwise, return a vector.

Examples

# Convert missing value to NULL
vec_null()
vec_null(NA)
vec_null("na", alt_na="na")

# Convert string to vector when input is not missing
num_vec <- vec_null("2,8,3,7")

# Convert string to NULL when a single element is missing
vec_null("2,3,NA,5", "NA")


mmints documentation built on April 3, 2025, 9:33 p.m.