jitter_min: jitter_min

View source: R/jitter_min.R

jitter_minR Documentation

jitter_min

Description

Add a small amount of noise to a numeric vector. The result is x + runif(n, -a, a) where n <- length(x) and a <- abs(factor*amount) argument. If amount==0 then amount is set to 1e-6 times the smallest non-zero distance between adjacent unique x values. In case of no non-zero distances amount is set to 1e-6*(1+min(abs(x))). Note that jitter_min delivers different results then base::jitter.

Usage

jitter_min(x, factor = 1, amount = 0)

Arguments

x

numeric: vector to which jitter should be added

factor

numeric: multiplier for amount (default: 1)

amount

numeric: amount for jittering (default: 0)

Value

jittered data

Examples

jitter_min(runif(6))
jitter_min(rep(0, 7))
jitter_min(rep(10000, 5))

sigbertklinke/smvgraph documentation built on Dec. 10, 2022, 9:13 a.m.