Simulates the effect of one or more preprocessing steps on a dataset and returns a report describing which variables would be removed, how many observations might be deleted, and other changes. The input data are not altered.
dry_run(data, steps = c("varidele", "obsedele", "outlier"),
cols = NULL, group = NULL, date_col = NULL,
fraction = 0.25, top = 0.995, bottom = 0.0025,
by = "min", half = 30, method_outlier = "iqr", coef = 1.5,
verbose = FALSE)A list with the following components:
original_n: number of rows in the original data.
original_ncol: number of columns in the original data.
varidele: a list containing removed column names and count (if step included).
obsedele: a list with rows_before, rows_after, and removed.
outlier: a list with na_before, na_after, and added.
final_n: number of rows remaining after simulation, reflecting both variable deletion and observation deletion.
final_ncol: number of columns remaining after simulation.
A data frame to be simulated.
Character vector of steps to simulate. Currently supported: "varidele", "obsedele", and "outlier".
Column indices or names of numeric variables to consider. If NULL, all numeric columns are used.
Optional grouping column for outlier detection.
Optional time column for observation deletion.
Missing fraction threshold for variable deletion.
Top percentile for outlier detection (percentile method).
Bottom percentile for outlier detection (percentile method).
Time unit for consecutive missing deletion (see obsedele).
Half window size in minutes for consecutive missing deletion.
Outlier detection method: "iqr", "mad", or "percentile".
Coefficient for IQR or MAD outlier detection.
Logical; if TRUE, prints progress message.
This function is useful for understanding the potential impact of preprocessing without changing the dataset. It actually runs varidele, obsedele, and detect_outliers on a copy of the input, and returns precise per-step before/after counts. The caller's data frame is never modified.
dry_run(data[1:200, c(1, 4, 17:19)], cols = 3:5, steps = c("varidele", "obsedele", "outlier"))
Run the code above in your browser using DataLab