Normalise data using different methods: log, power, and root, with a different number of parameters to find out which one transforms the data into a normal-ish set.

Usage,
transform_data(
  data,
  trait = "DATA",
  alpha = 0.05,
  index = NULL,
  transf_vals = c(2, exp(1), 3, 4, 5, 6, 7, 8, 9, 10),
  plots_prefix = file.path(tempdir(), "HIST"),
  digits = 6
)

Arguments

data

Original data.

trait

Trait name.

alpha

Significance level.

index

Index of the current trait.

transf_vals

Transformation values.

plots_prefix

Prefix for plots with or without path.

digits

Significant digits to compare p-values of transformations.

Value

Transformed record.

Examples

set.seed(123)
data <- rnorm(100, 5)
out_exp2 <- MetaPipe::transform_data(2 ^ data, "EXP_2")
#> Warning: Using ragg device as default. Ignoring `type` and `antialias` arguments
out_root2 <- MetaPipe::transform_data(sqrt(data), "ROOT_2")
#> Warning: Using ragg device as default. Ignoring `type` and `antialias` arguments
out_pow2 <- MetaPipe::transform_data(data ^ 2, "POW_2")
#> Warning: Using ragg device as default. Ignoring `type` and `antialias` arguments

knitr::kable(head(out_exp2))
#> 
#> 
#> |index |trait |   values|flag   |transf | transf_val|
#> |:-----|:-----|--------:|:------|:------|----------:|
#> |      |EXP_2 | 4.439524|Normal |log    |          2|
#> |      |EXP_2 | 4.769823|Normal |log    |          2|
#> |      |EXP_2 | 6.558708|Normal |log    |          2|
#> |      |EXP_2 | 5.070508|Normal |log    |          2|
#> |      |EXP_2 | 5.129288|Normal |log    |          2|
#> |      |EXP_2 | 6.715065|Normal |log    |          2|
knitr::kable(head(out_root2))
#> 
#> 
#> |index |trait  |   values|flag   |transf | transf_val|
#> |:-----|:------|--------:|:------|:------|----------:|
#> |      |ROOT_2 | 4.439524|Normal |power  |          2|
#> |      |ROOT_2 | 4.769823|Normal |power  |          2|
#> |      |ROOT_2 | 6.558708|Normal |power  |          2|
#> |      |ROOT_2 | 5.070508|Normal |power  |          2|
#> |      |ROOT_2 | 5.129288|Normal |power  |          2|
#> |      |ROOT_2 | 6.715065|Normal |power  |          2|
knitr::kable(head(out_pow2))
#> 
#> 
#> |index |trait |   values|flag   |transf |transf_val |
#> |:-----|:-----|--------:|:------|:------|:----------|
#> |      |POW_2 | 2.994219|Normal |root   |e          |
#> |      |POW_2 | 3.156560|Normal |root   |e          |
#> |      |POW_2 | 3.990077|Normal |root   |e          |
#> |      |POW_2 | 3.301778|Normal |root   |e          |
#> |      |POW_2 | 3.329897|Normal |root   |e          |
#> |      |POW_2 | 4.059846|Normal |root   |e          |