set_classes: Change column classes with a named vector

Description Usage Arguments Value Examples

View source: R/data_prep.R

Description

Change column classes with a named vector

Usage

1
2
3
4
5
6
7
8

Arguments

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.

Value

Changes by reference the types of the specified columns

Examples

1
2
3
4
5
library(chronicle)
iris_changed <- chronicle::set_classes(dt = iris,
                                       character = 'Species',
                                       integer = c('Sepal.Length', 'Sepal.Width'))
purrr::map_chr(iris_changed, class)

chronicle documentation built on June 25, 2021, 9:09 a.m.