This function behaves like base::paste(), but replaces any NA elements with an empty string.
It also supports vector recycling and accepts the 'sep' and 'collapse' arguments.
paste_(..., sep = " ", collapse = NULL)
Arguments
- ...
The arguments to be concatenated. These can be vectors.
- sep
The string that separates the concatenated elements. Defaults to a single space.
- collapse
An optional string to separate the results. NULL by default, which means no separation.
Value
A character vector of concatenated strings.
Examples
paste_("hello", NA, "you")
#> [1] "hello you"
# returns "hello you"
paste_(c("hello", "world"), c(NA, "everyone"), c("you", NA))
#> [1] "hello you" "world everyone"
# returns c("hello you", "world everyone")