Description Usage Arguments Author(s) Examples
Set NAs to a value
1 |
data |
a data.frame |
value.to.set.na.to |
a character vector specifying the value to set NA to |
Daniel Gardiner (daniel.gardiner@phe.gov.uk)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # set dummy data
set.seed(4)
data = data.frame(dates = sample(seq(as.Date('2014-01-01'), as.Date('2016-04-01'), by="day"), 20, replace = TRUE),
sex = factor(c("Male", "Female", "Female", NA)),
conf = factor(sample(c("Confirmed", "Probable", "Possible"), 20, replace = TRUE)),
status = sample(c("Student", "Staff", NA), 20, replace = TRUE),
age = sample(c(1:20, NA), 20, replace = TRUE),
stringsAsFactors = FALSE)
# apply function
set_na_to(data, c("Unknown"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.