View source: R/prune_cladistic_matrix.R
prune_cladistic_matrix | R Documentation |
Prunes a character matrix of characters, taxa, or both.
prune_cladistic_matrix(
cladistic_matrix,
blocks2prune = c(),
characters2prune = c(),
taxa2prune = c(),
remove_invariant = FALSE
)
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 |
remove_invariant |
A logical for whether invariant characters should (TRUE) or should not (FALSE, default) be pruned. |
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).
Graeme T. Lloyd graemetlloyd@gmail.com
build_cladistic_matrix, compactify_cladistic_matrix, read_nexus_matrix, safe_taxonomic_reduction, write_nexus_matrix, write_tnt_matrix
# 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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.