R/echoice2.R
get_attr_lvl.Rd
Obtain attributes and levels from tidy choice data with dummies
get_attr_lvl(tdc)
A tibble with choice data
tibble
mytest=data.frame(A=factor(c('a','a','b','c','c')), B=1:5)
dummied_data = dummify(mytest,"A")
get_attr_lvl(dummied_data)
#> # A tibble: 4 × 7
#> # Groups: attribute [2]
#> name attr_level attribute lvl reference_lvl reference lvl_abbrv
#> <int> <chr> <chr> <chr> <chr> <dbl> <chr>
#> 1 1 A:a A a a 1 a
#> 2 2 A:b A b a 0 b
#> 3 3 A:c A c a 0 c
#> 4 4 B NA NA NA NA NA