uniteNameLevel {visOmopResults} | R Documentation |
Unite one or more columns in name-level format
Description
Unites targeted table columns into a pair of name-level columns.
Usage
uniteNameLevel(
x,
cols = character(0),
name = "group_name",
level = "group_level",
keep = FALSE,
ignore = c(NA, "overall")
)
Arguments
x |
A dataframe. |
cols |
Columns to aggregate. |
name |
Column name of the |
level |
Column name of the |
keep |
Whether to keep the original columns. |
ignore |
Level values to ignore. |
Value
A tibble with the new columns.
Examples
x <- dplyr::tibble(
variable = "number subjects",
value = c(10, 15, 40, 78),
sex = c("Male", "Female", "Male", "Female"),
age_group = c("<40", ">40", ">40", "<40")
)
x |>
uniteNameLevel(
cols = c("sex", "age_group"),
name = "new_column_name",
level = "new_column_level"
)
[Package visOmopResults version 0.3.0 Index]