View source: R/as_categorical.R
| as_categorical.decorated | R Documentation |
Coerces (elements of) 'decorated' to categorical. See example(s). Briefly, a continuous variable with units (and a small set of existing values) is converted to a factor-ready variable.
## S3 method for class 'decorated'
as_categorical(x, ...)
x |
decorated |
... |
unquoted names of columns to be converted |
decorated
Other decorated:
[.decorated(),
[<-.decorated(),
[[.decorated(),
[[<-.decorated(),
as_categorical(),
merge.decorated(),
names<-.decorated()
library(magrittr)
library(tablet)
library(kableExtra)
library(yamlet)
x <- data.frame(DOSE = c(12, 1.2, 2.4, 6, 12, 1.2)) %>% decorate('DOSE: [ Dose, mg ]')
x %>%
as_categorical(DOSE) %>%
resolve %>%
tablet %>%
as_kable %>%
kable_classic
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.