1 \name{write.nexus.data}
2 \alias{write.nexus.data}
4 Write Character Data In NEXUS Format
7 This function writes in a file a list of sequences in the NEXUS
8 format.The names of the vectors of the list are used as taxon names.
11 write.nexus.data(x, file, format = "dna", datablock = TRUE,
12 interleaved = TRUE, charsperline = NULL,
13 gap = NULL, missing = NULL)
16 \item{x}{a list of sequences each made of a single vector of mode
17 character where each element is a character state (e.g. \dQuote{A},
19 \item{file}{a file name specified by either a variable of mode
20 character, or a double-quoted string.}
21 \item{format}{a character string specifying the format of the
22 sequences. Two choices are possible: \code{dna}, or \code{protein},
23 or any unambiguous abbreviation of these. Default is
25 \item{datablock}{a logical, if \code{TRUE} the data are written in a
26 single DATA block. If \code{FALSE} data is written in TAXA and
27 CHARACTER blocks. Default is \code{TRUE}.}
28 \item{interleaved}{a logical, if \code{TRUE} the data is written in
29 interleaved format with number of characters per line as specified
30 with \code{charsperline = numerical_value}. If \code{FALSE}, data is
31 written in sequential format. Default is \code{TRUE}.}
32 \item{charsperline}{a numeric specifying the number of characters per
33 line when used with \code{interleaved = TRUE}. Default is
35 \item{gap}{a character specifying the symbol for gap. Default is
37 \item{missing}{a character specifying the symbol for missing
38 data. Default is \dQuote{\code{?}}.}
41 If the sequences have no names, then they are given \dQuote{1},
42 \dQuote{2}, ..., as names in the file.
44 Sequences must be all of the same length (i.e., aligned).
46 Default symbols for missing data and gaps can be changed by using the
47 \code{missing} and \code{gap} commands.
49 Please see files \file{data.nex} and \file{taxacharacters.nex} for
50 examples of output formats.
53 None (invisible \sQuote{NULL}).
56 Maddison, D. R., Swofford, D. L. and Maddison, W. P. (1997) NEXUS: an
57 extensible file format for systematic information. \emph{Systematic
58 Biology}, \bold{46}, 590--621.
62 \author{Johan Nylander \email{nylander@scs.fsu.edu}}
64 \code{\link{read.nexus}},\code{\link{write.nexus}},
65 \code{\link{read.nexus.data}}
68 \dontrun{\dontshow{library(ape)}}
69 ## Write interleaved DNA data with 100 characters per line in a DATA block
70 \dontrun{data("woodmouse")}
71 \dontrun{write.nexus.data(woodmouse, file= "woodmouse.example.nex", interleaved = TRUE, charsperline = 100)}
72 ## Write sequential DNA data in TAXA and CHARACTERS blocks
73 \dontrun{data("cynipids")}
74 \dontrun{write.nexus.data(cynipids, file= "cynipids.example.nex", format = "protein", datablock = FALSE, interleaved = FALSE)}
75 \dontrun{\dontshow{unlink(c("woodmouse.example.nex", "cynipids.example.nex"))}}