set_classes | R Documentation |
Change column classes with a named vector
set_classes(
dt,
character = NULL,
integer = NULL,
double = NULL,
logical = NULL,
factor = NULL
)
dt |
Table whose column types will be changed |
character |
The columns that will be coerced to character. |
integer |
The columns that will be coerced to integer. |
double |
The columns that will be coerced to double. |
logical |
The columns that will be coerced to logical. |
factor |
The columns that will be coerced to factor. |
Changes by reference the types of the specified columns
library(chronicle)
iris_changed <- chronicle::set_classes(dt = iris,
character = 'Species',
integer = c('Sepal.Length', 'Sepal.Width'))
purrr::map_chr(iris_changed, class)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.