MatrixToPhyDat | R Documentation |
phyDat
objectsMatrixToPhyDat()
converts a matrix of tokens to a phyDat
object;
PhyDatToMatrix()
converts a phyDat
object to a matrix of tokens.
MatrixToPhyDat(tokens)
PhyDatToMatrix(
dataset,
ambigNA = FALSE,
inappNA = ambigNA,
parentheses = c("{", "}"),
sep = ""
)
tokens |
Matrix of tokens, possibly created with |
dataset |
A dataset of class |
ambigNA , inappNA |
Logical specifying whether to denote ambiguous /
inapplicable characters as |
parentheses |
Character vector specifying style of parentheses
with which to enclose ambiguous characters. |
sep |
Character with which to separate ambiguous tokens, e.g. |
MatrixToPhyDat()
returns an object of class phyDat
.
PhyDatToMatrix()
returns a matrix corresponding to the
uncompressed character states within a phyDat
object.
Martin R. Smith (martin.smith@durham.ac.uk)
Other phylogenetic matrix conversion functions:
StringToPhyDat()
tokens <- matrix(c(0, 0, "0", 0, 0,
0, 0, "1", 0, 1,
0, 0, "1", 0, 1,
0, 0, "2", 0, 1,
1, 1, "-", 1, 0,
1, 1, "2", 1, "{01}"),
nrow = 6, ncol = 5, byrow = TRUE,
dimnames = list(
paste0("Taxon_", LETTERS[1:6]),
paste0("Char_", 1:5)))
MatrixToPhyDat(tokens)
data("Lobo", package = "TreeTools")
head(PhyDatToMatrix(Lobo.phy)[, 91:93])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.