type_convert_with_labels: Convert column types according to a col_spec

View source: R/cb.R

type_convert_with_labelsR Documentation

Convert column types according to a col_spec

Description

Custom wrapper around readr::type_convert() that suppresses warnings and copies labels, in order to (mostly) match the behavior of cb_apply_col_spec(). but without re-implementing a lot of functionality.

Usage

type_convert_with_labels(df, col_types = NULL, ...)

Arguments

df

The data.frame to process.

col_types

The col_spec to apply.

...

Other arguments to readr::type_convert().

Details

A known key difference compared cb_apply_col_spec() is that df is fully processed according to the col_types argument, meaning that other columns may be converted in addition to the factor columns.

Value

A data.frame based on d, with any factor columns specified in col_types converted to factor and any other columns processed according to the functionality of readr::type_convert()


torfason/zulutils documentation built on Aug. 21, 2023, 5:46 p.m.