Set and get the character weightings associated with a Morphy object.
Source:R/mpl_morphy_objects.R
MorphyWeights.Rd
MorphyWeights()
details the approximate and exact weights associated with
characters in a Morphy
object; SetMorphyWeights()
edits them.
Arguments
- morphyObj
Object of class
morphy
, perhaps created withPhyDat2Morphy()
.- weight
A vector listing the new weights to be applied to each character
- checkInput
Whether to sanity-check input data before applying. Defaults to
TRUE
to protect the user from crashes.
Value
MorphyWeights()
returns a data frame with two named rows and
one column per character pattern:
row 1, approx
, is a list of integers specifying the approximate (integral)
weights used by MorphyLib;
row 2, exact
, is a list of numerics specifying the exact weights specified
by the user.
SetMorphyWeights()
returns the Morphy error code generated when
applying weight
.
See also
Other Morphy API functions:
GapHandler()
,
MorphyErrorCheck()
,
PhyDat2Morphy()
,
SingleCharMorphy()
,
UnloadMorphy()
,
is.morphyPtr()
,
mpl_apply_tipdata()
,
mpl_attach_rawdata()
,
mpl_attach_symbols()
,
mpl_delete_Morphy()
,
mpl_delete_rawdata()
,
mpl_first_down_recon()
,
mpl_first_up_recon()
,
mpl_get_charac_weight()
,
mpl_get_gaphandl()
,
mpl_get_num_charac()
,
mpl_get_num_internal_nodes()
,
mpl_get_numtaxa()
,
mpl_get_symbols()
,
mpl_init_Morphy()
,
mpl_new_Morphy()
,
mpl_second_down_recon()
,
mpl_second_up_recon()
,
mpl_set_charac_weight()
,
mpl_set_num_internal_nodes()
,
mpl_set_parsim_t()
,
mpl_translate_error()
,
mpl_update_lower_root()
,
mpl_update_tip()
,
summary.morphyPtr()
Examples
tokens <- matrix(c(
0, 0, 0, 1, 1, 2,
0, 0, 0, 0, 0, 0), byrow = TRUE, nrow = 2L,
dimnames = list(letters[1:2], NULL))
pd <- TreeTools::MatrixToPhyDat(tokens)
morphyObj <- PhyDat2Morphy(pd)
MorphyWeights(morphyObj)
#> [,1] [,2] [,3]
#> approx 3 2 1
#> exact 3 2 1
if (SetMorphyWeights(c(1, 1.5, 2/3), morphyObj) != 0L) message("Errored")
MorphyWeights(morphyObj)
#> [,1] [,2] [,3]
#> approx 6 9 4
#> exact 1 1.5 0.6666667
morphyObj <- UnloadMorphy(morphyObj)