forceFactor: Function for checking whether a treedata object contains only...

Description Usage Arguments Value Examples

View source: R/treeplyr_functions.R

Description

This function can be used to check if a treedata object contains factors and, if desired, convert all columns automatically to factors.

Usage

1
forceFactor(tdObject, return.factor = TRUE)

Arguments

tdObject

A treedata object

return.factor

If TRUE, then a treedata object with all factors will be returned; columns will be forced into factors using factor and any with no repeated elements will be removed.

Value

If return.factor, then an object of class "treedata" with all columns as factors.

Examples

1
2
3
data(anolis)
td <- make.treedata(anolis$phy, anolis$dat)
tdforcefactor <- forceFactor(td)

treeplyr documentation built on Sept. 17, 2020, 5:07 p.m.