Learn R Programming

leakr (version 0.1.0)

validate_and_preprocess_data: Robust data validation and preprocessing

Description

This function performs data validation and preprocessing for audit purposes. It checks the validity of the input data, ensures that the target and ID columns exist, and handles empty or problematic columns.

Usage

validate_and_preprocess_data(data, target, split, id)

Value

The validated and preprocessed data.

Arguments

data

A data frame, tibble, or data table to be validated and preprocessed.

target

The name of the target column, which should be present in the data. If NULL, no target validation is performed.

split

A vector specifying the split column, which will be checked in the data. If NULL, no split validation is performed.

id

The name of the ID column, which should be present in the data. If NULL, no ID validation is performed.

Examples

Run this code
if (FALSE) {
# Example data
data <- data.frame(target = rnorm(100), id = 1:100)
target <- "target"
id <- "id"
validated_data <- validate_and_preprocess_data(data, target, NULL, id)
}

Run the code above in your browser using DataLab