Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/build_cladistic_matrix.R
Creates a morphological data file from a character-taxon matrix.
1 2 3 4 5 6 7 8 9 |
character_taxon_matrix |
A Character-Taxon (columns-rows) matrix, with taxon names as rownames. |
header |
A scalar indicating any header text (defaults to an empty string: ""). |
character_weights |
A vector specifying the weights used (if not specified defaults to 1). |
ordering |
A vector indicating whether characters are ordered ("ord") or unordered ("unord") (if no specified defaults to ordered). |
symbols |
The symbols to use if writing to a file (defaults to the numbers 0:9 then the letters A to V). |
equalise.weights |
Optional that overrides the weights specified above make all characters truly equally weighted. |
ignore_duplicate_taxa |
Logical indicating whether or not to ignore (allow; TRUE) duplicate taxa or not (FALSE; default). |
Claddis generally assumes that matrices will be imported into R from the #NEXUS format, but in some cases (e.g., when using simulated data) it might be desirable to build a matrix within R. This function allows the user to convert such a matrix into the format required by other Claddis functions as long as it only contains a single block.
NB: Currently the function cannot deal directly with step matrices or continuous characters.
topper |
Contains any header text or step matrices and pertains to the entire file. |
matrix_N |
One or more matrix blocks (numbered 1 to N) with associated information pertaining only to that matrix block. This includes the block name (if specificed, NA if not), the block datatype (one of "CONTINUOUS", "DNA", "NUCLEOTIDE", "PROTEIN", "RESTRICTION", "RNA", or "STANDARD"), the actual matrix (taxa as rows, names stored as rownames and characters as columns), the ordering type of each character ("ord" = ordered, "unord" = unordered), the character weights, the minimum and maximum values (used by Claddis' distance functions), and the original characters (symbols, missing, and gap values) used for writing out the data. |
Graeme T. Lloyd graemetlloyd@gmail.com
compactify_matrix, prune_cladistic_matrix, read_nexus_matrix, safe_taxonomic_reduction, write_nexus_matrix, write_tnt_matrix
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # Create random 10-by-50 matrix:
character_taxon_matrix <- matrix(sample(c("0", "1", "0&1", NA, ""),
500,
replace = TRUE
),
nrow = 10, dimnames =
list(apply(matrix(sample(LETTERS, 40,
replace = TRUE
), nrow = 10), 1, paste,
collapse = ""
), c())
)
# Reformat for use elsewhere in Claddis:
build_cladistic_matrix(character_taxon_matrix)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.