Description Usage Arguments Value Examples
View source: R/03-recode_others.R
Function to recode others responses
1 |
df |
A data.frame containing data from the Liberia Coverage Survey |
var |
A character value for variable name containing 'others' responses |
ls |
A list of thematically named string pattern vectors to use for searching and organising 'others' responses |
label |
A character vector for names of the resulting data.frame. |
A data.frame with same number of rows as 'df' and number of columns equal to the length of 'ls' containing recoded values
1 2 3 4 5 6 7 8 9 | ifa3d <- c("delivery", "hospital", "constantly") # Did not go to hospital
ifa3e <- c("know") # Don't know about the tablets
ifa3f <- c("any", "go") # Didn't get any tablets
ifa3g <- c("given") # Was given but never took it
ifa3h <- c("interest", "interested", "Not") # Not interested
ifa3i <- c("Reasons") # No reasons
ls1 <- list(ifa3d, ifa3e, ifa3f, ifa3g, ifa3h, ifa3i)
names(ls1) <- paste("ifa3", letters[4:9], sep = "")
recode_others(df = coverageData1.r2, var = "ifa3a_other", ls = ls1)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.