This function oversamples the minority class in a data frame to match the size of the majority class.

oversample_minority(x, vname)

Arguments

x

data frame containing the data to be oversampled

vname

character string specifying the name of the column containing the class labels

Value

data frame with the minority class oversampled to match the size of the majority class

Examples

data <- data.frame(class = c(rep("A", 10), rep("B", 100)), 
                   feature1 = rnorm(110), 
                   feature2 = rnorm(110))
oversampled_data <- oversample_minority(data, "class")