Skip to contents

Aliases a data.frame. Replaces column names with labels, where present. Stores column name as 'alias' attribute.

Usage

# S3 method for class 'data.frame'
alias(object, ...)

Arguments

object

data.frame

...

optional unquoted names of target columns

Value

aliased data.frame

Examples

library(magrittr)
d <- data.frame(x = 1:10, y = 1:10, z = 1:10)
d %<>% modify(x, label = 'Independent Value')
d %<>% modify(y, label = 'Dependent Value')
d
#>     x  y  z
#> 1   1  1  1
#> 2   2  2  2
#> 3   3  3  3
#> 4   4  4  4
#> 5   5  5  5
#> 6   6  6  6
#> 7   7  7  7
#> 8   8  8  8
#> 9   9  9  9
#> 10 10 10 10
alias(d)
#>    Independent Value Dependent Value  z
#> 1                  1               1  1
#> 2                  2               2  2
#> 3                  3               3  3
#> 4                  4               4  4
#> 5                  5               5  5
#> 6                  6               6  6
#> 7                  7               7  7
#> 8                  8               8  8
#> 9                  9               9  9
#> 10                10              10 10
alias(d, y)
#>     x Dependent Value  z
#> 1   1               1  1
#> 2   2               2  2
#> 3   3               3  3
#> 4   4               4  4
#> 5   5               5  5
#> 6   6               6  6
#> 7   7               7  7
#> 8   8               8  8
#> 9   9               9  9
#> 10 10              10 10