ca_coords: Calculate correspondence analysis row and column coordinates.

Description Usage Arguments Details Value Examples

View source: R/CA.R

Description

'ca_coords' calculates the standard and principal coordinates of the rows and columns in CA space.

Usage

1
ca_coords(caobj, dims = NULL, princ_coords = 3, princ_only = FALSE)

Arguments

caobj

A "cacomp" object as outputted from 'cacomp()'.

dims

Integer indicating the number of dimensions to use for the calculation of coordinates. All elements of caobj (where applicable) will be reduced to the given number of dimensions. Default NULL (keeps all dimensions).

princ_coords

Integer. Number indicating whether principal coordinates should be calculated for the rows (=1), columns (=2), both (=3) or none (=0). Default 3.

princ_only

Logical, whether only principal coordinates should be calculated. Or, in other words, whether the standard coordinates are already calculated and stored in 'caobj'. Default 'FALSE'.

Details

Takes a "cacomp" object and calculates standard and principal coordinates for the visualisation of CA results in a biplot or to subsequently calculate coordinates in an association plot.

Value

Returns input object with coordinates added. std_coords_rows/std_coords_cols: Standard coordinates of rows/columns. prin_coords_rows/prin_coords_cols: Principal coordinates of rows/columns.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# Simulate scRNAseq data.
cnts <- data.frame(cell_1 = rpois(10, 5),
                   cell_2 = rpois(10, 10),
                   cell_3 = rpois(10, 20))
rownames(cnts) <- paste0("gene_", 1:10)
cnts <- as.matrix(cnts)

# Run correspondence analysis.
ca <- cacomp(obj = cnts, princ_coords = 1)
ca <- ca_coords(ca, princ_coords = 3)

elagralinska/APLpackage documentation built on Dec. 20, 2021, 4:15 a.m.