coerce_from_factor: Coerce dataframe variables to new type

Description Usage Arguments Value Author(s)

Description

Coerce many variables to new classes based on a named list of variable names with values of the character string of their target class.

Usage

1
2
coerce_from_factor(data, class_list, preserve = TRUE, suffix = ".old",
  verbose = FALSE)

Arguments

data

the dataframe whose variables should be coerced to a new class

class_list

a named list of classes to be coerced to from class factor, with the list names being the variable names (e.g. list(vs = 'character', carb = 'numeric')). Classes are all coerced using the function as.<class>(levels(<var>)[<var>]).

preserve

whether original factor variables should be preserved

suffix

a suffix to add to preserved variable names

verbose

whether additional information should be printed to console

Value

the original dataframe with variables coerced to the target class and optionally preserved copies of the original variables.

Author(s)

Doug Kelkhoff [email protected]


lengning/gClinBiomarker documentation built on May 9, 2019, 2:55 p.m.