powered by
Fix NA-like strings to be NA (or other value of choice)
fix_na_ish(x, extra_na = NULL, new_val = NA)
data frame
Additional values to consider equivalent to NA
New value to be used instead of NA-ish values, default is NA
NA
# NOT RUN { 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") # }
Run the code above in your browser using DataLab