read.nex | R Documentation |
This function reads NEXUS data stored in nexus, text, or pdf files. Note: for pdf files, it is necessary to first install poppler with, e.g., 'brew install poppler'
read.nex(
file,
charlabels = NULL,
charnums = NULL,
statelabels = NULL,
taxlabels = NULL,
filename = NULL,
ntax = NULL,
nchar = NULL,
first = NULL,
last = NULL,
missing = "?",
gap = "-"
)
file |
(required) path to either a .nex, .txt, or .pdf file with NEXUS data |
charlabels |
optional path to text file with character statements |
charnums |
optional vector with character numbers |
statelabels |
optional character vector with state labels for characters |
taxlabels |
optional vector with names of taxa |
filename |
vector with names of files associated with characters |
ntax |
number of taxa (needed for PDF file reading) |
nchar |
number of characters (needed for PDF file reading) |
first |
first page for data matrix in a PDF file |
last |
last page for data matrix in a PDF file |
missing |
character representing missing data |
gap |
character representing inapplicable/incomporable data |
an object of class nex
for use in further phenotools
functions
Chad Eliason celiason@fieldmuseum.org
Bertelli, S. and Chiappe, L. M. (2005). Earliest Tinamous (Aves: Palaeognathae) from the Miocene of Argentina and Their Phylogenetic Position. Contributions in Science, 502, 1-20.
## Not run:
# Read in a nexus file:
x <- read.nex(file = system.file("extdata", "clarke_2006.nex",
package = "phenotools"))
# Build a `nex` object from text files:
charpath <- system.file("extdata", "brusatte2014_charlist.txt",
package = "phenotools")
matpath <- system.file("extdata", "brusatte2014_matrix.txt",
package = "phenotools")
x <- read.nex(matpath, charlabels=charpath)
# Build a `nex` object from a PDF file (Bertelli & Chiappe 2005):
x <- read.nex(file = system.file("extdata", "Bertelli_2005.pdf",
package = "phenotools"), ntax = 34, nchar = 63, first = 20, last = 22)
x
# Plot
plot(x, legend.pos = "top")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.