1
% Generated by roxygen2: do not edit by hand
2
% Please edit documentation in R/nexml_write.R
6
\title{Write nexml files}
8
nexml_write(x = new("nexml"), file = NULL, trees = NULL,
9
characters = NULL, meta = NULL, ...)
12
\item{x}{a nexml object, or any phylogeny object (e.g. phylo, phylo4)
13
that can be coerced into one. Can also be omitted, in which case a new
14
nexml object will be constructed with the additional parameters specified.}
16
\item{file}{the name of the file to write out}
18
\item{trees}{phylogenetic trees to add to the nexml file (if not already given in x)
19
see \code{\link{add_trees}} for details.}
21
\item{characters}{additional characters}
23
\item{meta}{A meta element or list of meta elements, see \code{\link{add_meta}}}
25
\item{...}{additional arguments to add__basic_meta, such as the title. See \code{\link{add_basic_meta}}.}
28
Writes out a nexml file
34
## Write an ape tree to nexml, analgous to write.nexus:
35
library(ape); data(bird.orders)
36
write.nexml(bird.orders, file="example.xml")
38
\dontrun{ # takes > 5s
39
## Assemble a nexml section by section and then write to file:
42
nexml <- add_trees(geospiza$phy) # creates new nexml
43
nexml <- add_characters(geospiza$dat, nexml = nexml) # pass the nexml obj to append character data
44
nexml <- add_basic_meta(title="my title", creator = "Carl Boettiger", nexml = nexml)
45
nexml <- add_meta(meta("prism:modificationDate", format(Sys.Date())), nexml = nexml)
47
write.nexml(nexml, file="example.xml")
49
## As above, but in one call (except for add_meta() call).
50
write.nexml(trees = geospiza$phy,
51
characters = geospiza$dat,
53
creator = "Carl Boettiger",
56
## Mix and match: identical to the section by section:
57
nexml <- add_meta(meta("prism:modificationDate", format(Sys.Date())))
58
write.nexml(x = nexml,
60
characters = geospiza$dat,
62
creator = "Carl Boettiger",
68
\code{\link{add_trees}} \code{\link{add_characters}} \code{\link{add_meta}} \code{\link{nexml_read}}