gen_outlier {baizer}R Documentation

generate outliers from a series of number

Description

generate outliers from a series of number

Usage

gen_outlier(
  x,
  n,
  digits = 0,
  side = "both",
  lim = NULL,
  assign_n = NULL,
  only_out = TRUE
)

Arguments

x

number vector

n

number of outliers to generate

digits

the digits of outliers

side

should be one of ⁠both, low, high⁠

lim

a two-length vector to assign the limitations of the outliers if method is both, the outliers will be limited in [lim[1], low_outlier_threshold] and [high_outlier_threshold, lim[2]] ; if method is low, the outliers will be limited in [lim[1], min(low_outlier_threshold, lim[2])] ; if method is high, the outliers will be limited in [max(high_outlier_threshold, lim[1]), lim[2]]

assign_n

manually assign the number of low outliers or high outliers when method is both

only_out

only return outliers

Value

number vector of outliers

Examples

x <- seq(0, 100, 1)

gen_outlier(x, 10)

# generation limits
gen_outlier(x, 10, lim = c(-80, 160))

# assign the low and high outliers
gen_outlier(x, 10, lim = c(-80, 160), assign_n = c(0.1, 0.9))

# just generate low outliers
gen_outlier(x, 10, side = "low")

# return with raw vector
gen_outlier(x, 10, only_out = FALSE)


[Package baizer version 0.8.0 Index]