Learn R Programming

chronicle (version 0.3)

set_classes: 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

Run this code
# NOT RUN {
library(chronicle)
iris_changed <- chronicle::set_classes(dt = iris,
                                       character = 'Species',
                                       integer = c('Sepal.Length', 'Sepal.Width'))
purrr::map_chr(iris_changed, class)
# }

Run the code above in your browser using DataLab