| get_same_class | R Documentation |
This function aligns the classes of variables in 'old_df' with those of their corresponding variables in 'new_df'. For each column name shared across both data frames, the function detects the class in 'new_df' and coerces the matching column in 'old_df' to the same class. Supported conversions include 'character', 'numeric', 'integer', 'logical', 'factor', and 'Date'. Any variable whose class is not explicitly handled is left unchanged.
get_same_class(old_df, new_df)
old_df |
A data frame containing the preceding version of the data, used as the reference for comparison. |
new_df |
A data frame containing the most recent version of the data. |
A modified version of 'old_df' in which all shared columns are coerced to match the variable classes of 'new_df'.
Lukasz Andrzejewski
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.