paste2: paste which can ignore NA and empty strings

View source: R/calculation_definitions.R

paste2R Documentation

paste which can ignore NA and empty strings

Description

Acts the same as regular paste, unless na.rm = TRUE, in which case empty strings and NA are removed

Usage

paste2(..., sep = " ", collapse = NULL, na.rm = FALSE)

Arguments

...

the list of strings to paste

sep

the separator string, " " by default

collapse

the collapse string, NULL by default

na.rm

whether to remove NA and empty strings

Details

based on code by Moody_Mudskipper at https://stackoverflow.com/questions/13673894/suppress-nas-in-paste with additional code from https://stackoverflow.com/questions/14270950/suppress-separator-in-paste-when-values-are-missing

Value

string


DavidPatShuiFong/dMeasure documentation built on Aug. 2, 2024, 11:45 p.m.