Set elements to NA values using tidyselect specification.
Don't use this function on columns of different modes at once.
Defaults to choosing all character columns.
# S3 method for data.frame
make_na(.data, ..., vec = c("-", "", " ", "null", "NA", "NA_"))
make_na(.data, ..., vec = c("-", "", " ", "null", "NA", "NA_"))
Arguments
- .data
data frame
- ...
tidyselect. Default selection: all chr cols
- vec
vector of possible elements to replace with NA
Examples
# easily set NA values. blank space and empty space are default options
tibble::tibble(x = c("a", "b", "", "d", " ", "", "e")) %>%
make_na()
#> # A tibble: 7 × 1
#> x
#> <chr>
#> 1 a
#> 2 b
#> 3 NA
#> 4 d
#> 5 NA
#> 6 NA
#> 7 e