Description Usage Arguments Value Author(s) Examples
View source: R/recodeVariable.R
Automatically recode a categorical text variable with the help of the data dictionary.
1 | recodeVariable(varName, varVect, dataDict)
|
varName |
The name of the categorical variable to be recoded. |
varVect |
The vector of responses for the specified variable. |
dataDict |
The "Categories" sheet of the data dictionary produced by Opal. The data dictionary is an Excel spreadsheet that contains the two following sheets: "Variables" and "Categories". |
Returns a recoded vector of the categorical variable. Note that if the function replaces entries by NA, then the data dictionary is incomplete for the specified variable.
Phil Boileau, philippe.boileau (at) rimuhc.ca
1 2 3 4 5 6 7 8 9 10 11 | ## Not run:
library(xlxs)
dataSet <- read.csv("path_to_file.csv")
dataDict <- read.xlsx("path_to_data_dictionary.xlsx", sheetName = "Categories")
recodeVariable(varName = "countryOfBirth",
varVect = cobVect,
dataDict = dictionary.df)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.