set_classes {chronicle}R Documentation

Change column classes with a named vector

Description

Change column classes with a named vector

Usage

set_classes(
  dt,
  character = NULL,
  integer = NULL,
  double = NULL,
  logical = NULL,
  factor = NULL
)

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

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

[Package chronicle version 0.3 Index]