explode_variable: Explode a single variable into multiple variables

Description Usage Arguments Value Author(s) Examples

View source: R/explode_variable.R

Description

Explode a single variable into multiple variables

Usage

1
explode_variable(data, vars, break.value = ", ")

Arguments

data

a data.frame

vars

a character vector specifying the columns to 'explode' into multiple seperate columns

break.value

a character specifying the value to insert as a break between collapsed variables

id.col

a character specifying the column containing ID's

Value

a numeric vector containing age in years

Author(s)

Daniel Gardiner (daniel.gardiner@phe.gov.uk)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# define dummy data

data = data.frame(id = c("A", "B", "C", "D"),
                  activities = c("gym, cell 1, workshop a",
                                 "workshop a, cell 2, NA",
                                 "gym, NA, NA",
                                 "NA, NA, NA"))

# apply explode_variable function

explode_variable(data, vars = "activities")

DanielGardiner/EpiFunc documentation built on July 25, 2019, 10:53 p.m.