Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

resample_random

Randomly resample a dataset.


Description

This function is used to resample a dataset by randomly removing or duplicating rows. It is usable for both oversampling and undersampling.

Usage

resample_random(data, cls, cls_col, m)

Arguments

data

Dataframe to be resampled.

cls

Class that should be randomly resampled.

cls_col

Column containing class information.

m

Desired number of samples.

Value

Resampled dataframe containing only cls.

Examples

set.seed(1234)
only2 <- resample_random(wine, 2, "type", 15)

scutr

Balancing Multiclass Datasets for Classification Tasks

v0.1.2
MIT + file LICENSE
Authors
Keenan Ganz [aut, cre]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.