gap_as_state: Treat gaps as a state

View source: R/gap_as_state.R

gap_as_stateR Documentation

Treat gaps as a state

Description

The function gap_as_state changes the contrast of an phyDat object to treat as its own state. Internally phyDat are stored similar to a factor objects and only the contrast matrix and some attributes change.

Usage

gap_as_state(obj, gap = "-", ambiguous = "?")

gap_as_ambiguous(obj, gap = "-")

has_gap_state(obj)

Arguments

obj

An object of class phyDat.

gap

a character which codes for the gaps (default is "-").

ambiguous

a character which codes for the ambiguous state

Value

The functions return an object of class phyDat.

Author(s)

Klaus Schliep klaus.schliep@gmail.com

See Also

phyDat, latag2n.phyDat, latag2n, ancestral.pml, gap_as_state

Examples

data(Laurasiatherian)
tmp <- gap_as_state(Laurasiatherian)
contr <- attr(tmp, "contrast")
rownames(contr) <- attr(tmp, "allLevels")
contr

KlausVigo/phangorn documentation built on Nov. 5, 2024, 11 a.m.