Apply bestNormalize
Transformation to Variables in a Dataset and Update Dataset Accordingly
Source: R/get_transformation.R
get_transformation.Rd
The transform_and_update
function takes a dataset and a vector of variable names,
applies the bestNormalize
function to each variable, creates transformed versions of the
variables when necessary, and updates the dataset and the variable list accordingly.
It returns a list containing the updated dataset and the updated variable list.
Arguments
- data
A dataframe to which the
bestNormalize
function should be applied.- var_list
A character vector of variable names.
- seed
A single value, interpreted as an integer, to set the random seed for reproducibility.
Value
A list with two elements: data
containing the updated dataframe and var_list
containing
the updated variable list.
Examples
if (FALSE) {
# Generate some data
df <- data.frame(
daily_sat_aut = rnorm(100),
daily_fru_aut = rnorm(100),
daily_sat_rel = rnorm(100),
daily_fru_rel = rnorm(100)
)
# Apply the `bestNormalize` function and update dataset
result <- transform_and_update(df, var_list = c("daily_sat_aut", "daily_fru_aut", "daily_sat_rel", "daily_fru_rel"))
updated_df <- result$data
updated_var_list <- result$var_list
}