Description Usage Arguments Value Examples
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.
1 2 3 4 5 6 7 8 9 |
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.
1 2 3 4 | 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.