Learn R Programming

phytools (version 1.5-1)

to.matrix: Convert a character vector to a binary matrix

Description

Creates a binary matrix, normally from a factor.

Usage

to.matrix(x, seq)

Value

A binary matrix of dimensions length(x) by length(seq).

Arguments

x

a vector of characters.

seq

the sequence for the columns in the output matrix.

Author

Liam Revell liam.revell@umb.edu

Details

This function takes a vector of characters or a factor and computes a binary matrix.

Primarily designed to be used internally by make.simmap and rerootingMethod.

References

Revell, L. J. (2012) phytools: An R package for phylogenetic comparative biology (and other things). Methods Ecol. Evol., 3, 217-223.