convert_data_types: Converts the data types of specified variables in a dataset.

View source: R/convert_data_types.R

convert_data_typesR Documentation

Converts the data types of specified variables in a dataset.

Description

Converts columns in a data frame to specified types based on a named list mapping column names to target types. Supports conversion to numeric, character, factor, integer, logical, and other R data types.

Usage

convert_data_types(df, conversions)

Arguments

df

A data frame containing the variables to be converted.

conversions

A named list where names correspond to variable names in the dataset, and values are the desired data types (e.g., 'numeric', 'factor').

Value

A data frame with converted variable types.


clinCompare documentation built on Feb. 19, 2026, 1:07 a.m.