Skip to contents

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 = "?", latag2n = FALSE)

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

latag2n

transform leading and trailing gaps as ambiguous states.

Value

The functions return an object of class phyDat.

See also

Author

Klaus Schliep klaus.schliep@gmail.com

Examples

data(Laurasiatherian)
tmp <- gap_as_state(Laurasiatherian)
contr <- attr(tmp, "contrast")
rownames(contr) <- attr(tmp, "allLevels")
contr
#>   a c g t -
#> a 1 0 0 0 0
#> c 0 1 0 0 0
#> g 0 0 1 0 0
#> t 0 0 0 1 0
#> u 0 0 0 1 0
#> m 1 1 0 0 0
#> r 1 0 1 0 0
#> w 1 0 0 1 0
#> s 0 1 1 0 0
#> y 0 1 0 1 0
#> k 0 0 1 1 0
#> v 1 1 1 0 0
#> h 1 1 0 1 0
#> d 1 0 1 1 0
#> b 0 1 1 1 0
#> n 1 1 1 1 0
#> ? 1 1 1 1 1
#> - 0 0 0 0 1