~ubuntu-branches/debian/stretch/r-cran-rnexml/stretch

« back to all changes in this revision

Viewing changes to man/nexml_write.Rd

  • Committer: Package Import Robot
  • Author(s): Andreas Tille
  • Date: 2016-04-08 13:58:39 UTC
  • Revision ID: package-import@ubuntu.com-20160408135839-ilq08z8v8p414qpn
Tags: upstream-2.0.6
ImportĀ upstreamĀ versionĀ 2.0.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
% Generated by roxygen2: do not edit by hand
 
2
% Please edit documentation in R/nexml_write.R
 
3
\name{nexml_write}
 
4
\alias{nexml_write}
 
5
\alias{write.nexml}
 
6
\title{Write nexml files}
 
7
\usage{
 
8
nexml_write(x = new("nexml"), file = NULL, trees = NULL,
 
9
  characters = NULL, meta = NULL, ...)
 
10
}
 
11
\arguments{
 
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.}
 
15
 
 
16
\item{file}{the name of the file to write out}
 
17
 
 
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.}
 
20
 
 
21
\item{characters}{additional characters}
 
22
 
 
23
\item{meta}{A meta element or list of meta elements, see \code{\link{add_meta}}}
 
24
 
 
25
\item{...}{additional arguments to add__basic_meta, such as the title.  See \code{\link{add_basic_meta}}.}
 
26
}
 
27
\value{
 
28
Writes out a nexml file
 
29
}
 
30
\description{
 
31
Write nexml files
 
32
}
 
33
\examples{
 
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")
 
37
 
 
38
\dontrun{ # takes > 5s
 
39
 ## Assemble a nexml section by section and then write to file:
 
40
 library(geiger)
 
41
 data(geospiza)
 
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)
 
46
 
 
47
 write.nexml(nexml, file="example.xml")
 
48
 
 
49
 ## As above, but in one call (except for add_meta() call).  
 
50
 write.nexml(trees = geospiza$phy, 
 
51
             characters = geospiza$dat, 
 
52
             title = "My title", 
 
53
             creator = "Carl Boettiger",
 
54
             file = "example.xml")
 
55
 
 
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,
 
59
             trees = geospiza$phy, 
 
60
             characters = geospiza$dat, 
 
61
             title = "My title", 
 
62
             creator = "Carl Boettiger",
 
63
             file = "example.xml")
 
64
 
 
65
}
 
66
}
 
67
\seealso{
 
68
\code{\link{add_trees}} \code{\link{add_characters}} \code{\link{add_meta}} \code{\link{nexml_read}}
 
69
}
 
70