Resolves implicit usage of default key 'guide' to
explicit usage for factor.
Calls explicit_guide
followed by classified.
If option yamlet_with_title is not NULL, and if 'units'
present, label and units will be concatenated by default to create
a title attribute (but this is generally unexpected).
Usage
# S3 method for class 'factor'
resolve(x, ...)Arguments
- x
factor
- ...
passed to
explicit_guide,classified, andmake_title
Details
If decorating a factor with a guide, it is recommended to supply one that resolves to a codelist. An even safer practice is to convert the factor first to character, so that there are no factor levels to disagree with the (somewhat equivalent) codelist.
See also
Other resolve:
desolve(),
desolve.classified(),
desolve.data.frame(),
desolve.decorated(),
desolve.default(),
desolve.dvec(),
enscript.data.frame(),
enscript.default(),
resolve(),
resolve.classified(),
resolve.data.frame(),
resolve.decorated(),
resolve.default(),
resolve.dvec()
Other dvec:
[.dvec(),
[<-.dvec(),
[[.dvec(),
[[<-.dvec(),
as.data.frame.dvec(),
as_dvec(),
as_dvec.character(),
as_dvec.complex(),
as_dvec.dvec(),
as_dvec.integer(),
as_dvec.logical(),
as_dvec.numeric(),
c.dvec(),
classified.dvec(),
desolve.dvec(),
explicit_guide.data.frame(),
format.dvec(),
implicit_guide.dvec(),
implicit_guide.factor(),
length.dvec(),
print.dvec(),
resolve.classified(),
resolve.dvec(),
unclassified.dvec()
Examples
library(magrittr)
x <- factor(1:3)
attr(x, 'guide') <- list(a = 1, b = 2, c = 3)
x
#> [1] 1 2 3
#> attr(,"guide")
#> attr(,"guide")$a
#> [1] 1
#>
#> attr(,"guide")$b
#> [1] 2
#>
#> attr(,"guide")$c
#> [1] 3
#>
#> Levels: 1 2 3
resolve(x)
#> [1] a b c
#> attr(,"codelist")
#> attr(,"codelist")$`1`
#> [1] a
#>
#> attr(,"codelist")$`2`
#> [1] b
#>
#> attr(,"codelist")$`3`
#> [1] c
#>
#> Levels: a b c
x <- data.frame(bar = x)
x
#> bar
#> 1 1
#> 2 2
#> 3 3
resolve(x)
#> bar
#> 1 a
#> 2 b
#> 3 c