typeset: Set type of columns

View source: R/typeset.R

typesetR Documentation

Set type of columns

Description

Given an index of columns, convert identified columns of data.frame to factor, ordered factor, or integer. A number of datasets are distributed with an accompanying index of this sort, especially to define which variables should be treated as categorical (here, factors) for predicting modeling. This functions aims to make data type conversions in those cases easier.

Usage

typeset(
  x,
  factor.index = NULL,
  orderedfactor.index = NULL,
  integer.index = NULL
)

Arguments

x

data frame: input whose columns' types you want to edit

factor.index

Integer, vector: Index of columns to be converted to factors using factor(x)

orderedfactor.index

Integer, vector: Index of columns to be converted to ordered factors using factor(x, ordered = TRUE)

integer.index

Integer, vector: Index of columns to be converted to integers using as.integer

Author(s)

E.D. Gennatas


egenn/rtemis documentation built on Oct. 28, 2024, 6:30 a.m.