knitr::opts_chunk$set(echo = TRUE) library(epiuf)
To expand a variable containing more than one value into new individual variables with Y/N values The list of expected values must be passed as parameters together with the name of the new variable to be created The format of the list is :
list("value1"="variable_name1", "value2"="variable_name2" )
Example :
testvac <- data.frame(Id = 1:3 , Vaccs = c("1|2|3", "2", "3|1")) InfoSource <- list("1" = "vacccard", "2" = "registry", "3" = "hospnotes", "9" = "oth") df <- expandVar(data = testvac, varname =Vaccs, valueslist= InfoSource) head(df)
data <- data.frame(Id = 1:4 , Vaccs = c("pfizer,moderna"," ", "pfizer", "moderna")) brand <- list("pfizer"="PFIZER", "moderna"="MODERNA" ) data <- expandVar(data,Vaccs,brand) head(data)
data <- data.frame(Id = 1:4 , Vaccs = c("pfizer,moderna"," ", "pfizer", "moderna")) file1 <- externalFile("genericdictionary.xlsx") openDictionary(file1) data <- expandVarAll(data) head(data)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.