auto_trans: transformation

View source: R/data-auto-trans.R

auto_transR Documentation

transformation

Description

transformation

Usage

auto_trans(x, ...)

## S3 method for class 'data.frame'
auto_trans(x, add = TRUE, ...)

## Default S3 method:
auto_trans(x, treshhold = 1, ...)

Arguments

x

Vector

...

weitere Argumente

add

spalte hinzufügen oder ersätzen

treshhold

grundlienie

Value

Vector mit attr link, inverse und name

Examples

n<-100
x1 = rnorm(100)+5
x2 = rlnorm(n, meanlog = 0, sdlog = 1)+1
x3 = rpois(n, lambda = 1)+1
x4 = rweibull(n, shape = .8, scale = 1)+10
x5 = runif(n, min = 0, max = 100)+1


auto_trans(x2)
#'
x.neg <- rbeta(10000, 5, 2)  # Negative Skew

x.pos <- rexp(1000, 1) # Positive Skew
par(mfrow=c(2,2))
hist(x.neg)
hist(x.pos)
hist(auto_trans(x.neg))
hist(auto_trans(x.pos))


n <- 100

scale_100 <- function(x) {
  x <- x - min(x)
  round(x / max(x) * 100)
}

DF <- data.frame(
  group = gl(2, n / 2, labels = c("Control", "Treat")),
  x1 = scale_100(rnorm(100) + 5),
  x2 = scale_100(rlnorm(n, meanlog = 0, sdlog = 1) + 1),
  x3 = scale_100(rpois(n, lambda = 1) + 1),
  x4 = scale_100(rweibull(n, shape = .8, scale = 1) + 10),
  x5 = scale_100(runif(n, min = 0, max = 100) + 1),
  x6 = scale_100(sqrt(rnorm(100) + 5))
)

auto_trans(DF)


stp4/stp25tools documentation built on Feb. 27, 2025, 11:14 p.m.