Learn R Programming

Claddis (version 0.3.4)

MatrixPruner: Prunes a character matrix of characters or taxa

Description

Prunes a character matrix of characters, taxa, or both.

Usage

MatrixPruner(CladisticMatrix, blocks2prune = c(),
  characters2prune = c(), taxa2prune = c(), removeinvariant = FALSE)

Arguments

CladisticMatrix

The cladistic matrix in the format imported by ReadMorphNexus.

blocks2prune

A vector of number(s) of any blocks to prune.

characters2prune

A vector of character numbers to prune.

taxa2prune

A vector of taxon names to prune (these must be present in rownames(CladisticMatrix$matrix).

removeinvariant

A logical for whether invariant characters should (TRUE) or should not (FALSE, default) be pruned.

Details

Removing characters or taxa from a matrix imported using ReadMorphNexus is not simple due to associated vectors for ordering, character weights etc. To save repetitively pruning each part this function takes the matrix as input and vector(s) of either block numbers, character numbers, taxon names, or any combination thereof and returns a matrix with these items removed. Minimum and maximum values (used by MorphDistMatrix) are also updated and the user has the option to remove constant characters this way as well (e.g, to reduce the memory required for a DNA matrix).

See Also

ReadMorphNexus

Examples

Run this code
# NOT RUN {
# Remove the outgroup taxon and characters 11 and 53 from Gauthier1986:
prunedmatrix <- MatrixPruner(CladisticMatrix = Gauthier1986, characters2prune = c(11, 53),
  taxa2prune = c("Outgroup"))

# Show priuned matrix:
prunedmatrix$Matrix_1$Matrix

# }

Run the code above in your browser using DataLab