Description Usage Arguments Value Examples
View source: R/short_generic.R
This can be useful when exporting a dataframe to a csv or excel format. It gets rid of the printed NA values in the output.
1 | set_empty(x)
|
x |
a character vector |
A vector x
of strings with NAs converted to an empty string
("")
1 2 3 4 5 6 7 8 | # Set NA values in a vector to empty strings
fish_na = c("STHD", NA, "CHUM", "CHIN")
fish_missing = set_empty(fish_na)
# Set NA values in an entire dataframe to empty strings
fish_na = tibble::tibble(fish_day = c("Mon", NA_character_, "Wed", "Thur"),
fish_sp = c("STHD", NA_character_, "CHUM", "CHIN"))
fish_na[] = lapply(fish_na, set_empty)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.