Description Usage Arguments Value Examples
Rename categories of one or more variables in the dataset using an external match file
1 |
Data |
data frame to be processed. |
varsClean |
a character vector of variables to be regrouped. |
matchFileName |
a character string naming a match file. The match file is an excel file with one or multiple sheets.
Sheetname must be corresponding to variable names in |
... |
other arguments passed on to |
a data frame of regrouped variables.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | data(QueenslandRaw)
matchFileName <- system.file("extdata","QueenslandMatch.xlsx", package = "pplpredict")
# View the first six lines of the sheet varNames in "QueenslandMatch.xlsx"
head(xlsx::read.xlsx(matchFileName, sheetName = "varNames", stringsAsFactors = FALSE, header = FALSE))
cleanData(QueenslandRaw, c("genderRaw","studentRaw","educationRaw"), matchFileName)
cleanData(QueenslandRaw, c("genderRaw","studentRaw","educationRaw"), matchFileName)
# Rename variables in a dataset
cleanData(QueenslandRaw, "varNames", matchFileName)
varsClean <- c("varNames", "genderRaw", "educationRaw", "studentRaw", "birthYearRaw", "industryRaw",
"polInterestRaw", "polConsumptionRaw", "religionRaw", "selfPlacementRaw", "birthplaceRaw",
"incomeRaw", "voteChoiceRaw", "voteChoiceLeaningRaw")
cleanData(QueenslandRaw, varsClean, "QueenslandMatch.xlsx")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.