Title: | Apply Manipulations to Data Frames |
---|---|
Description: | Provides a set of functions for manipulating data frames in accordance with specific business rules. In addition, it includes wrapper functions for commonly used functions from the popular 'tidyverse' package, making it easy to integrate these functions into data analysis workflows. The package is designed to streamline data preprocessing and help users quickly and efficiently perform data transformations that are specific to their business needs. |
Authors: | Tomer Iwan [aut, cre, cph] |
Maintainer: | Tomer Iwan <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.4.10 |
Built: | 2025-02-18 03:40:07 UTC |
Source: | https://github.com/cran/vvsculptor |
Correct level names for modelling and in the use of ROC curve/AUC.
correct_model_levels(data)
correct_model_levels(data)
data |
String with level names. |
Corrected level names.
data <- data.frame(id = c(1,2,3), name = c("Alice","Bob","Charlie"), gender = factor(c("Female","Male","Female"), levels = c("Female","Male"))) correct_model_levels(data) # returns a data frame with factor levels of the variable gender corrected to "Female" and "Male" data <- data.frame(id = c(1,2,3), name = c("Alice","Bob","Charlie"), gender = factor(c("Female","Male","Female"))) correct_model_levels(data) # returns a data frame with factor levels of the variable gender corrected to "F" and "M"
data <- data.frame(id = c(1,2,3), name = c("Alice","Bob","Charlie"), gender = factor(c("Female","Male","Female"), levels = c("Female","Male"))) correct_model_levels(data) # returns a data frame with factor levels of the variable gender corrected to "Female" and "Male" data <- data.frame(id = c(1,2,3), name = c("Alice","Bob","Charlie"), gender = factor(c("Female","Male","Female"))) correct_model_levels(data) # returns a data frame with factor levels of the variable gender corrected to "F" and "M"
A wrapper around dplyr's left_join, with an error message if duplicate values are present in the matching fields in y. This will prevent duplicating rows. See dplyr::left_join .
strict_left_join(x, y, by = NULL, ...)
strict_left_join(x, y, by = NULL, ...)
x |
data frame x (left) |
y |
data frame y (right) |
by |
unquoted variable names to join. |
... |
Pass further arguments to dplyr::left_join |
merged data frame
left_df <- data.frame(id = c(1, 2, 3), name = c("Alice", "Bob", "Charlie")) right_df <- data.frame(id = c(1, 2, 4), age = c(20, 25, 30)) strict_left_join(left_df, right_df, by = "id")
left_df <- data.frame(id = c(1, 2, 3), name = c("Alice", "Bob", "Charlie")) right_df <- data.frame(id = c(1, 2, 4), age = c(20, 25, 30)) strict_left_join(left_df, right_df, by = "id")