diff --git a/man/fix_type_to_factor.Rd b/man/fix_type_to_factor.Rd new file mode 100644 index 0000000..5b0034b --- /dev/null +++ b/man/fix_type_to_factor.Rd @@ -0,0 +1,40 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/app_helper_data_raw_cleaning.R +\name{fix_type_to_factor} +\alias{fix_type_to_factor} +\title{Convert Specified Variables in a Dataset to Factors} +\usage{ +fix_type_to_factor(data_set, list_vars) +} +\arguments{ +\item{data_set}{A data frame or similar object containing the variables to be +converted to factors.} + +\item{list_vars}{A named list where each name corresponds to a variable in +`data_set` that should be converted to a factor. The value for each name +should be a logical value (`TRUE` or `FALSE`), indicating whether the +resulting factor should be ordered (`TRUE` for ordered, `FALSE` for +unordered).} +} +\value{ +The modified `data_set` with specified variables converted to factors. + If a variable is designated to be an ordered factor, it is converted + accordingly. +} +\description{ +This function iteratively converts specified variables within a dataset to +factors. For each variable specified, it can also designate the factor as +ordered based on a corresponding logical vector. The function operates on a +dataset (data frame or similar structure) and takes a named list where names +correspond to variables in the dataset and values are logical, indicating +whether the factor should be ordered. +} +\details{ +The function iterates over the `list_vars` names, checking each + corresponding variable in `data_set`. If the variable exists, it is + converted to a factor with the `ordered` parameter set as specified in + `list_vars`. Variables not found in `data_set` are skipped without error. + This allows for flexible data cleaning and preprocessing, especially when + preparing data for statistical analysis or machine learning models where + factor variables may be required. +}