na_replace | R Documentation |
Replace missing values
na_replace(df, how = NULL, value = NULL)
df |
The data set(data.frame or vector) for which replacements are required |
how |
How should missing values be replaced? One of ffill, samples,value or any other known method e.g mean, median, max ,min. The default is NULL meaning no imputation is done. For character vectors, the use of 'get_mode' is also supported. No implementation for class factor(yet). |
value |
If how is set to value, this allows the user to provide a specific fill value for the NAs. |
This function currently does not support grouping although this may be achieved with some inaccuracies using grouping functions from other packages.
A data.frame object with missing values replaced.
head(na_replace(airquality,how="value", value="Missing"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.