Skip to contents

This function combines a pair of group/group_level or variable/variable_level columns into a single column. The group_level or variable_level column is renamed according to the value of the group or variable column, respectively.

Usage

rename_ard_columns(x, columns = c(all_ard_groups(), all_ard_variables()))

Arguments

x

(data.frame)
a data frame

columns

(tidy-select)
Name of columns to coalesce together and rename.

Value

data frame

Examples

data <- data.frame(group1 = "A", group1_level = "B", variable = "C", variable_level = "D")

rename_ard_columns(data)
#> # A tibble: 1 × 2
#>   A     C    
#>   <chr> <chr>
#> 1 B     D    
rename_ard_columns(data, columns = c("group1", "group1_level"))
#> # A tibble: 1 × 3
#>   A     variable variable_level
#>   <chr> <chr>    <chr>         
#> 1 B     C        D