NA-aware drop-in replacement for str_c(). Discards NAs when other strings are present. Reduces multiple NAs to a single one.
Arguments
- ...
One or more character vectors.
NULLs are removed; scalar inputs (vectors of length 1) are recycled to the common length of vector inputs.Like most other R functions, missing values are "infectious": whenever a missing value is combined with another string the result will always be missing. Use
dplyr::coalesce()orstr_replace_na()to convert to the desired value.- sep
String to insert between input vectors.
- collapse
Optional string used to combine output into single string. Generally better to use
str_flatten()if you needed this behaviour.