Usage
strRemoveEmpty(x, naOk = TRUE, spacesOk = TRUE)
Arguments
- x
character
.
Character vector.
- naOk
logical(1)
.
Allow NA
values to propagate.
- spacesOk
logical(1)
.
Consider spaces to be non-empty.
Value
character
.
Modified vector, with empty strings removed.
Examples
x <- c("", "a", "b", " ", NA)
y <- strRemoveEmpty(x, naOk = TRUE, spacesOk = TRUE)
print(y)
#> [1] "a" "b" " " NA
y <- strRemoveEmpty(x, naOk = FALSE, spacesOk = FALSE)
print(y)
#> [1] "a" "b"