% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/output.results.R
\name{output.states.matrix}
\alias{output.states.matrix}
\title{Outputs results}
\usage{
output.states.matrix(states_matrix, output = NULL,
  file = "Inapp_reconstruction", path = ".", ...)
}
\arguments{
\item{states_matrix}{A \code{states.matrix} list from \code{\link{apply.reconstruction}}.}

\item{output}{The type of output, can be either \code{NULL} (default) or \code{"newick"}, \code{"nexus"}, \code{"csv"}, \code{"pdf"} or \code{"C-test"} (see details).}

\item{file}{The name of the output file(code{"character"}).}

\item{path}{The path where to save the output file (code{"character"}).}

\item{...}{If \code{output = "pdf"}, additional arguments to be passed to \code{plot.states.matrix}.}
}
\description{
Outputs ancestral states reconstruction results
}
\details{
The output contains the for different reconstructions (Dp1, Up1, Dp2, Up2), the potential change or applicable region and the list of tips and nodes
Specifically, per data output type:
-\code{"newick"} outputs a newick string with annotated nodes as follows: (t1[Dp1:X,Up1:X,Dp2:X,Up2:X,Change:X,Applicable:X]).
-\code{"nexus"} outputs a nexus file with a newick string similar as above but also containing the total tree score, the matrix (one character) and the list of taxa.
-\code{"csv"} A matrix containing the different state reconstructions and score for each tip and node.
-\code{"pdf"} A pdf version of the states_matrix plotted with \code{plot.states.matrix}.
-\code{"C-test"} a text version that can be used for testing in C (for DEBUG).

[Dp1:X,Up1:X,Dp2:X,Up2:X,Change:X,Applicable:X]: R:Dp1:X,Up1:X,Dp2:X,Up2:X,Change:X,Applicable:X%5C
}
\examples{
## A random 5 taxa tree
set.seed(1)
tree <- ape::rtree(5, br = NULL)
## A character with inapplicable data
character <- "01-?1"

## NA algorithm
NA_matrix <- apply.reconstruction(tree, character, passes = 4, method = "NA")

\dontrun{
## Exporting the results as an annotated newick tree
output.states.matrix(NA_matrix, output = "newick")

## Exporting the results and notes in a nexus file
output.states.matrix(NA_matrix, output = "nexus")

## Exporting the result in a csv
output.states.matrix(NA_matrix, output = "csv")

## Exporting the plot as a pdf
output.states.matrix(NA_matrix, output = "pdf")
}

}
\seealso{
\code{\link{apply.reconstruction}}, \code{\link{plot.states.matrix}}
}
\author{
Thomas Guillerme
}
