% Generated by roxygen2: do not edit by hand % Please edit documentation in R/NA.utilities.R \name{make.states.matrix} \alias{make.states.matrix} \title{Sates matrix} \usage{ make.states.matrix(tree, character, inapplicable = NULL, match.tip.char = FALSE) } \arguments{ \item{tree}{\code{phylo}, a tree} \item{character}{Either vector of character states (\code{"numeric"} or \code{"character"}) or a list of the same length of than the tips in the tree (see details)} \item{inapplicable}{When the intended reconstruction method is \code{"Fitch"}, how do deal with inapplicable data: \code{1}, \code{2} for respectively treating them as ? or an extra state (default = \code{NULL}).} \item{match.tip.char}{\code{logical}, \code{TRUE} to match the character to the tip labels (e.g character 1 matches with tip "a" or "1") or \code{FALSE} (default) to match the character to the tips entry (e.g. character 1 matches with the first tip)} } \value{ A list of character states for each node and tip per pass: -\code{$Char}: a \code{list} of character states for the tips. -\code{$Dp1}: a \code{list} of the tips' and nodes' states after the first downpass. -\code{$Up1}: a \code{list} of the tips' and nodes' states after the first uppass. -\code{$Dp2}: a \code{list} of the tips' and nodes' states after the second downpass. -\code{$Up2}: a \code{list} of the tips' and nodes' states after the second uppass. -\code{$tracker}: a \code{list} tracking the applicable regions. -\code{$regions}: a single \code{numeric} value counting the number of applicable regions. -\code{$changes}: a \code{numeric} vector recording the node with state changes. -\code{$score}: a \code{numeric} vector recording the score of the tree. -\code{$tree}: a \code{phylo} object describing the tree. -\code{$n_tip}: a \code{numeric} vector recording the number of tips. -\code{$n_node}: a \code{numeric} vector recording the number of (internal) nodes within the tree. } \description{ Creates a states matrix } \details{ If \code{character} argument is a list, each element of the list must be a \code{"numeric"} vector with \code{"?"} being all states and \code{"-"} being \code{-1}. } \examples{ ## A simple topology tree <- ape::read.tree(text = "((a,b),(c,d));") ## A simple character character <- "0101" ## Create a states matrix for reconstruction make.states.matrix(tree, character) ## A complex character character <- "0{01}-?" } \seealso{ \code{\link{apply.reconstruction}}. } \author{ Thomas Guillerme }