Description Usage Arguments Value Author(s) Examples
View source: R/explode_variable.R
Explode a single variable into multiple variables
1 | explode_variable(data, vars, break.value = ", ")
|
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 |
a numeric vector containing age in years
Daniel Gardiner (daniel.gardiner@phe.gov.uk)
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")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.