Claddis.ordination: Imports data from Claddis

View source: R/Claddis.ordination.R

Claddis.ordinationR Documentation

Imports data from Claddis

Description

Takes Claddis data and computes both the distance and the ordination matrix

Usage

Claddis.ordination(data, distance = "mord", ..., k, add = TRUE, arg.cmdscale)

Arguments

data

Data from read_nexus_matrix or the path to a file to be read by read.nexus.data (see details).

distance

Distance type to be computed by calculate_morphological_distances. Can be either "gc", "ged", "red", "mord". distance can also be set to NULL to convert a matrix in read_nexus_matrix list type (see details).

...

Any optional arguments to be passed to calculate_morphological_distances.

k

The number of dimensions in the ordination. If left empty, the number of dimensions is set to number of rows - 1.

add

whether to use the Cailliez correction for negative eigen values (add = TRUE; default - see cmdscale) or not (add = FALSE).

arg.cmdscale

Any optional arguments to be passed to cmdscale (as a named list such as list(x.ret = TRUE)).

Details

If data is a file path, the function will use a modified version of read.nexus.data (that handles polymorphic and ambiguous characters). The file content will then be converted into a read_nexus_matrix type list treating all characters as unordered. If the distance is set to NULL, data will be only converted into a read_nexus_matrix type list.

Author(s)

Thomas Guillerme

See Also

calculate_morphological_distances, read_nexus_matrix, build_cladistic_matrix, cmdscale, custom.subsets, chrono.subsets, boot.matrix, dispRity.

Examples

## Not run: 
require(Claddis)

## Ordinating the distance matrix of Claddis example data
Claddis.ordination(Claddis::michaux_1989)

## Creating simple discrete morphological matrix (with polymorphisms)
cat(
"#NEXUS
BEGIN DATA;
DIMENSIONS  NTAX=5 NCHAR=5;
FORMAT SYMBOLS= \" 0 1 2\" MISSING=? GAP=- ;
MATRIX
     t1  {01}1010
     t2  02120
     t3  1210(01)
     t4  01111
     t5  00101
;
END;", file = "morpho_matrix.nex")

## Ordinating the matrix (using a distance matrix)
Claddis.ordination("morpho_matrix.nex")

## Only converting the nexus matrix into a Claddis format
Claddis_data <- Claddis.ordination("morpho_matrix.nex", distance = NULL)

file.remove("morpho_matrix.nex")

## End(Not run)


TGuillerme/dispRity documentation built on Aug. 15, 2024, 12:16 p.m.