compactify_matrix {Claddis} | R Documentation |
Collapses a cladistic matrix to just unique character state distributions and taxon names.
compactify_matrix(cladistic_matrix, message = TRUE)
cladistic_matrix |
The cladistic matrix in the format imported by read_nexus_matrix. |
message |
Logical indicating whether or not a message should be printed to the screen if the matrix cannot be compactified. |
Important: not recommended for general use.
This function is intended to make a matrix with redundant character state distributions smaller by collapsing these to single characters and upweighting them accordingly. It is intended purely for use with MRP matrices, but may have some very restricted uses elsewhere.
The function also deletes any characters weighted zero from the matrix and will merge duplicate taxon names into unique character strings.
Graeme T. Lloyd graemetlloyd@gmail.com
build_cladistic_matrix, prune_cladistic_matrix, read_nexus_matrix, safe_taxonomic_reduction, write_nexus_matrix, write_tnt_matrix
# Examine the matrix pre-compactification: michaux_1989$matrix_1$matrix # Examine the weights pre-compactification: michaux_1989$matrix_1$character_weights # Compactify the matrix: michaux_1989compact <- compactify_matrix(michaux_1989) # Examine the matrix post-compactification: michaux_1989compact$matrix_1$matrix # Examine the weights post-compactification: michaux_1989compact$matrix_1$character_weights