Returns the percentage of total variance captured by each principal component from a previously computed PCA reduction.
Arguments
- object
A
SpatialCellData-classobject.
Examples
counts <- matrix(rnorm(500), nrow = 50,
dimnames = list(NULL, paste0("M", 1:10)))
coords <- data.frame(x = runif(50), y = runif(50))
obj <- RunPCA(CreateSpatialObject(counts, coords), n_pcs = 5)
VarianceExplained(obj)
#> PC_1 PC_2 PC_3 PC_4 PC_5
#> 19.65410 14.41696 13.84016 11.95552 10.68559