Skip to contents

Creates a new Morphy object with the same size and characters as the phyDat object. Once finished with the object, it should be destroyed using UnloadMorphy() to free the allocated memory.

Usage

PhyDat2Morphy(phy, gap = "inapplicable", weight = attr(phy, "weight"))

Arguments

phy

An object of phangorn class phyDat.

gap

An unambiguous abbreviation of inapplicable, ambiguous (= missing), or extra state, specifying how gaps will be handled.

weight

Numeric giving weight to apply to each character. Will be recycled.

Value

PhyDat2Morphy() returns a pointer to an initialized Morphy object.

Examples

data("Lobo", package="TreeTools")
morphyObj <- PhyDat2Morphy(Lobo.phy)
# Set object to be destroyed at end of session or closure of function
# on.exit(morphyObj <- UnloadMorphy(morphyObj), add = TRUE)

# Do something with pointer
# ....

# Or, instead of on.exit, manually destroy morphy object and free memory:
morphyObj <- UnloadMorphy(morphyObj)