fix_na_ish: Fix NA-like strings to be NA (or other value of choice)

Description Usage Arguments Examples

View source: R/na.r

Description

Fix NA-like strings to be NA (or other value of choice)

Usage

1
fix_na_ish(x, extra_na = NULL, new_val = NA)

Arguments

x

data frame

extra_na

Additional values to consider equivalent to NA

new_val

New value to be used instead of NA-ish values, default is NA

Examples

1
2
3
4
5
6
7
8
df <- data.frame(
  a = c("NA", "n/a", 1, NA),
  b = c("three", "na", NaN, "  N/A "),
  stringsAsFactors = FALSE
)
df
fix_na_ish(df)
fix_na_ish(df, extra_na = "three", new_val = "0")

jackwasey/jwutil documentation built on May 18, 2019, 7:58 a.m.