powered by
This function is used to resample a dataset by randomly removing or duplicating rows. It is usable for both oversampling and undersampling.
resample_random(data, cls, cls_col, m)
Resampled dataframe containing only cls.
cls
Dataframe to be resampled.
Class that should be randomly resampled.
Column containing class information.
Desired number of samples.
set.seed(1234) only2 <- resample_random(wine, 2, "type", 15)
Run the code above in your browser using DataLab