upsample: Up sample

View source: R/upsample.R

upsampleR Documentation

Up sample

Description

Randomly up-sample the minority condition(s) to have the same number of observations as the majority condition. Random samples are added to the existing observations of the minority conditions

Usage

upsample(x, condition, .name = "condition")

Arguments

x

A data.frame or something coercible to one

condition

A character vector the same length as 'x' denoting which condition each observation belongs to

.name

A string used to name the condition column

Value

A tibble

Examples

d <- data.frame(
  condition = c(rep("a", times = 7), rep("b", times = 3)),
  x = sample(0:1, size = 10, replace = TRUE),
  y = sample(0:1, size = 10, replace = TRUE)
)

upsample(x = d, condition = d$condition)

NetFACS documentation built on Dec. 7, 2022, 1:12 a.m.