| NexusTokensToInteger | R Documentation |
NexusTokensToInteger() converts the character matrix returned by
ReadCharacters() to an integer matrix, mapping polymorphic,
ambiguous (?), and inapplicable (-) tokens to NA_integer_ or to the
first/last state listed in the polymorphism, depending on polymorphism.
NexusTokensToInteger(tokens, polymorphism = c("?", "first", "last"))
tokens |
Character matrix as returned by |
polymorphism |
Character string specifying how to handle polymorphic
tokens such as
Tokens |
Only digit states 0..9 are recognised; non-digit symbols (and any
token whose interior contains no digits) become NA_integer_.
Polymorphism extraction (polymorphism = "first"/"last") likewise
considers digits only.
If tokens is a phyDat object it is first converted via
PhyDatToMatrix() with ambigNA = TRUE, inappNA = TRUE, so that
fully-ambiguous and inapplicable rows become NA_integer_ and only
true partial polymorphisms are subject to the polymorphism rule.
An integer matrix (or vector) with the same dimensions and
dimnames as tokens.
Martin R. Smith (martin.smith@durham.ac.uk)
Other phylogenetic matrix conversion functions:
Decompose(),
MatrixToPhyDat(),
Reweight(),
StringToPhyDat()
tokens <- matrix(c("0", "(12)", "1", "?", "-"),
nrow = 1,
dimnames = list("Taxon_A", paste0("C", 1:5)))
NexusTokensToInteger(tokens)
NexusTokensToInteger(tokens, polymorphism = "first")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.