transform transforms observation variables based on the specified transformation method.

transform(population, variables, operation = "generalized_log", ...)

Arguments

population

tbl with grouping (metadata) and observation variables.

variables

character vector specifying observation variables.

operation

optional character string specifying method for transform. This must be one of the strings "generalized_log" (default), "spherize", or "sparse_random_projection".

...

arguments passed to transformation operation.

Value

transformed data of the same class as population.

Examples

population <- tibble::tibble( Metadata_Well = c("A01", "A02", "B01", "B02"), Intensity_DNA = c(8, 20, 12, 32), Intensity_RNA = c(1, 12, -1, 4), Intensity_AGP = c(-2, 5, -5, -2), Intensity_Mito = c(-1, 15, 5, 22), Intensity_ER = c(-12, 15, -25, 24) ) variables <- c("Intensity_DNA", "Intensity_RNA", "Intensity_AGP", "Intensity_ER") transform(population, variables, operation = "generalized_log")
#> # A tibble: 4 x 6 #> Metadata_Well Intensity_DNA Intensity_RNA Intensity_AGP Intensity_Mito #> <chr> <dbl> <dbl> <dbl> <dbl> #> 1 A01 2.08 0.188 -2.14 -1 #> 2 A02 3.00 2.49 1.62 15 #> 3 B01 2.49 -1.57 -3.01 5 #> 4 B02 3.47 1.40 -2.14 22 #> # … with 1 more variable: Intensity_ER <dbl>
transform(population, variables, sample = population, operation = "husk", remove_outliers = FALSE)
#> # A tibble: 4 x 6 #> Metadata_Well Intensity_Mito V1 V2 V3 V4 #> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 A01 -1 -0.636 -0.292 0.167 1.39e-17 #> 2 A02 15 1.09 -0.551 -0.0552 1.39e-17 #> 3 B01 5 -1.03 0.0465 -0.143 -2.78e-17 #> 4 B02 22 0.581 0.796 0.0314 2.78e-17
transform(population, variables, sample = population, operation = "spherize")
#> # A tibble: 4 x 6 #> Metadata_Well Intensity_Mito PC1 PC2 PC3 PC4 #> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 A01 -1 0.622 -0.427 1.21 8.33e-15 #> 2 A02 15 -0.626 -1.17 -0.631 3.66e-15 #> 3 B01 5 1.05 0.576 -0.836 -1.20e-14 #> 4 B02 22 -1.05 1.02 0.255 -2.22e-16
transform(population, variables, n_components = 2, operation = "sparse_random_projection")
#> # A tibble: 4 x 4 #> Metadata_Well Intensity_Mito R1 R2 #> <chr> <dbl> <dbl> <dbl> #> 1 A01 -1 -4 2 #> 2 A02 15 35 -5 #> 3 B01 5 -13 5 #> 4 B02 22 56 2