cb_apply_col_spec() applies column definitions contained in a col_spec
object (typically created using readr::cols()), to the chosen columns in a
data.frame.
NOTE: This is currently only implemented for column specifications specifying conversion to a factor variable.
Usage
cb_apply_col_spec(
d,
cspec,
warn_missing_levels = TRUE,
set_spec_attribute = FALSE,
set_problems_attribute = TRUE
)Arguments
- d
The
data.frameto which thecol_specshould be applied.- cspec
The
col_specto apply.- warn_missing_levels
Warn if any values in
ddon't match the levels of the corresponding factor.- set_spec_attribute
Should the
specattribute of the result be set to thecol_spec(for compatibility withreadrbehavior).- set_problems_attribute
Should the
problemsattributes of the result be set in case of problems with parsing.