
Last chance! 50% off unlimited learning
Sale ends in
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 = ""
)
MatrixToPhyDat()
returns an object of class phyDat
.
PhyDatToMatrix()
returns a matrix corresponding to the
uncompressed character states within a phyDat
object.
Matrix of tokens, possibly created with ReadCharacters()
or ReadTntCharacters()
.
Row names should correspond to leaf labels; column names may optionally
correspond to character labels.
A dataset of class phyDat
.
Logical specifying whether to denote ambiguous /
inapplicable characters as NA
values.
Character vector specifying style of parentheses
with which to enclose ambiguous characters. c("[", "]")
or "[]"
will
render [01]
.
NULL
will use the token specified in the phyDat
object; but beware that
this will be treated as a distinct (non-ambiguous) token if re-encoding with
PhyDatToMatrix()
.
Character with which to separate ambiguous tokens, e.g. ','
will render [0,1]
.
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])
Run the code above in your browser using DataLab