Title: Apply Manipulations to Data Frames
Version: 0.4.10
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.
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 7.2.3
Imports: dplyr
NeedsCompilation: no
Packaged: 2023-01-28 08:08:06 UTC; tomer
Author: Tomer Iwan [aut, cre, cph]
Maintainer: Tomer Iwan <t.iwan@vu.nl>
Repository: CRAN
Date/Publication: 2023-01-30 16:20:02 UTC

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