Skip to contents

Retrieve a full analysis object (prcomp, hclust, etc.) that was stored using a compute_* function.

Usage

get_analysis(x, name)

Arguments

x

A tidymatrix object

name

Name of the analysis to retrieve

Value

The stored analysis object (class depends on analysis type)

Examples

tm <- tidymatrix(matrix(rnorm(100), 10, 10))
tm <- tm |>
  activate(columns) |>
  compute_prcomp(name = "pca")

# Get the full prcomp object
pca_obj <- get_analysis(tm, "pca")
summary(pca_obj)
#> Importance of components:
#>                           PC1    PC2    PC3     PC4    PC5     PC6     PC7
#> Standard deviation     2.3053 1.6118 1.2345 1.01769 0.9499 0.55297 0.45674
#> Proportion of Variance 0.4453 0.2177 0.1277 0.08678 0.0756 0.02562 0.01748
#> Cumulative Proportion  0.4453 0.6630 0.7907 0.87745 0.9530 0.97867 0.99615
#>                            PC8     PC9     PC10
#> Standard deviation     0.17107 0.12894 1.19e-16
#> Proportion of Variance 0.00245 0.00139 0.00e+00
#> Cumulative Proportion  0.99861 1.00000 1.00e+00
plot(pca_obj$sdev)  # Scree plot