Learn R Programming

Claddis (version 0.7.0)

prune_cladistic_matrix: Prunes a character matrix of characters or taxa

Description

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

Usage

prune_cladistic_matrix(
  cladistic_matrix,
  blocks2prune = c(),
  characters2prune = c(),
  taxa2prune = c(),
  remove_invariant = FALSE
)

Arguments

cladistic_matrix

The cladistic matrix in the format imported by read_nexus_matrix.

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(x = cladistic_matrix$matrix).

remove_invariant

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

Author

Graeme T. Lloyd graemetlloyd@gmail.com

Details

Removing characters or taxa from a matrix imported using read_nexus_matrix 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 calculate_morphological_distances) 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

build_cladistic_matrix, compactify_cladistic_matrix, read_nexus_matrix, safe_taxonomic_reduction, write_nexus_matrix, write_tnt_matrix

Examples

Run this code

# Remove the outgroup taxon and characters 11 and 53 from gauthier_1986:
prunedmatrix <- prune_cladistic_matrix(
  cladistic_matrix =
    gauthier_1986, characters2prune = c(11, 53), taxa2prune =
    c("Outgroup")
)

# Show priuned matrix:
prunedmatrix$matrix_1$matrix

Run the code above in your browser using DataLab