Skip to contents

Resolves classified. A non-operation since classified already has an explicit guide. Useful to make resolve() idempotent for 'dvec'.

Usage

# S3 method for class 'classified'
resolve(x, ...)

Arguments

x

classified

...

ignored

Value

classified

Examples

library(magrittr)
x <- as_dvec(1:3, guide = list(a = 1, b = 2, c = 3))
x %>% str
#>  'dvec' int [1:3] 1 2 3
#>  - attr(*, "guide")=List of 3
#>   ..$ a: num 1
#>   ..$ b: num 2
#>   ..$ c: num 3
x %>% classified %>% str
#>  Factor w/ 3 levels "1","2","3": 1 2 3
#>  - attr(*, "guide")=List of 3
#>   ..$ a: num 1
#>   ..$ b: num 2
#>   ..$ c: num 3
#>  - attr(*, "codelist")=List of 3
#>   ..$ : chr "1"
#>   ..$ : chr "2"
#>   ..$ : chr "3"
x %>% explicit_guide %>% classified %>% str
#>  Factor w/ 3 levels "a","b","c": 1 2 3
#>  - attr(*, "codelist")=List of 3
#>   ..$ 1: chr "a"
#>   ..$ 2: chr "b"
#>   ..$ 3: chr "c"
x %>% resolve %>% str
#>  Factor w/ 3 levels "a","b","c": 1 2 3
#>  - attr(*, "codelist")=List of 3
#>   ..$ 1: chr "a"
#>   ..$ 2: chr "b"
#>   ..$ 3: chr "c"
# idempotent:
x %>% resolve %>% resolve %>% str
#>  Factor w/ 3 levels "a","b","c": 1 2 3
#>  - attr(*, "codelist")=List of 3
#>   ..$ 1: chr "a"
#>   ..$ 2: chr "b"
#>   ..$ 3: chr "c"