pcl.pcoa: Perform Principal Coordinate Analysis (PCoA)

pcl.pcoaR Documentation

Perform Principal Coordinate Analysis (PCoA)

Description

This function performs Principal Coordinate Analysis (PCoA) on the input data or distance matrix.

Usage

pcl.pcoa(dat, D = NA, as = FALSE, asinsqrt = as, index = "bray/curtis", k = 2)

Arguments

dat

A list containing at least an element 'x' which is the data matrix.

D

Distance matrix. If NA, it will be computed from dat$x. Default is NA.

as

Logical. If TRUE, performs arcsine transformation (deprecated parameter). Default is FALSE.

asinsqrt

Logical. If TRUE, performs arcsine square root transformation. Default is the value of 'as'.

index

Character string specifying the distance index to use when computing D. Default is "bray/curtis".

k

Integer. The number of dimensions for PCoA. Must be at least 2. Default is 2.

Details

If a distance matrix D is not provided, the function computes it from the input data using the specified index. If asinsqrt is TRUE, the data is transformed using an arcsine square root transformation before computing distances. The PCoA is then performed on the distance matrix.

Value

A list containing PCoA results, including:

points

A matrix of PCoA coordinates

eig

Eigenvalues

ordnames

A character vector of dimension names with variance explained

Note

This function requires the 'vegan', 'labdsv', and 'ecodist' packages.

Examples

## Not run: 
data <- list(x = matrix(rnorm(1000), ncol = 10))
rownames(data$x) <- paste0("Sample", 1:100)
result <- pcl.pcoa(data, k = 3)
plot(result$points[,1], result$points[,2], main = "PCoA plot")

## End(Not run)


omicsEye/omicsArt documentation built on Oct. 8, 2024, 5:46 p.m.