expandVar | R Documentation |
explode a variable which contain a list of values into Y/N variables according to the content of the "multi" variable the list of expected values should be given with the names of the new variables
expandVar(data, varname, valueslist)
data |
A dataset which contain a multi-variable |
varname |
The name of the multi-variable |
valueslist |
List of expected values with names of the variables to be created |
A df with the new variables
data <- data.frame(Id = 1:4 ,
Vaccs = c("pfizer,moderna"," ", "pfizer", "moderna"))
brand <- list("pfizer"="pfizer",
"moderna"="moderna"
)
data <- expandVar(data,Vaccs,brand)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.