expandVar: expandVar

View source: R/expandVar.R

expandVarR Documentation

expandVar

Description

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

Usage

expandVar(data, varname, valueslist)

Arguments

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

Value

A df with the new variables

Examples


data <- data.frame(Id = 1:4 , 
                    Vaccs = c("pfizer,moderna"," ", "pfizer", "moderna"))
brand <- list("pfizer"="pfizer",
             "moderna"="moderna"
              )
data <-  expandVar(data,Vaccs,brand)



Epiconcept-Paris/STRAP-epiuf documentation built on Aug. 5, 2024, 3:41 a.m.