recode_na_as | R Documentation |
This provides a convenient way to recode "NA" as another value for instance "NaN", "n/a" or any other value a user wishes to use.
recode_na_as( df, value = 0, subset_cols = NULL, pattern_type = NULL, pattern = NULL, case_sensitive = FALSE, ... )
df |
A data.frame object for which recoding is to be done. |
value |
The value to convert to 'NA'. We can for instance change "n/a" to 'NA' or any other value. |
subset_cols |
An optional character vector to define columns for which changes are required. |
pattern_type |
One of contains', 'starts_with' or 'ends_with'. |
pattern |
A character pattern to match |
case_sensitive |
Defaults to FALSE. Patterns are case insensitive if TRUE |
... |
Other arguments to other functions |
An object of the same type as x with NAs replaced with the desired value.
head(recode_na_as(airquality, "n/a")) head(recode_na_as(airquality, subset_cols = "Ozone", value = "N/A")) head(recode_na_as(airquality, value=0, pattern_type="starts_with", pattern="Solar"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.