Package 'vvsculptor'

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

Help Index


Correct model levels

Description

Correct level names for modelling and in the use of ROC curve/AUC.

Usage

correct_model_levels(data)

Arguments

data

String with level names.

Value

Corrected level names.

Examples

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"

strict_left_join

Description

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 .

Usage

strict_left_join(x, y, by = NULL, ...)

Arguments

x

data frame x (left)

y

data frame y (right)

by

unquoted variable names to join.

...

Pass further arguments to dplyr::left_join

Value

merged data frame

See Also

left_join

Examples

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")