read.tree(file = "", format = "Newick", rooted = TRUE, text = NULL,
tree.names = NULL, skip = 0, comment.char = "#", ...)
file = ""
(the default) then the
tree is input on the keyboard, the entry being terminated with a blank line."Newick"
. Currently only the Newick format is available.TRUE
. This is currently not implemented, meaning
that all trees are read as rooted.NULL
, meaning that the tree is read in a
file); if text
is not NUL
NULL
(the default), the trees are named "tree1"
,
"tree2"
, ...scan()
).scan()
).scan()
."phylo"
with the following components:"-1"
), and the tips are represented with
positive numbers. For each row, the first column gives the
ancestor. This representation allows an easy manipulation of the
tree, particularly if it is rooted.edge
.edge
.NULL
if not available in the file).NULL
otherwise).c("phylo", "multi.tree")
, and is a list of objects of class "phylo"
.file
allows to type directly the tree on
the keyboard (or possibly to copy from an editor and paste in R's
console) with, e.g., mytree <- read.tree()
.write.tree
, scan
for the basic R
function to read data in a file### An extract from Sibley and Ahlquist (1990)
cat("(((Strix_aluco:4.2,Asio_otus:4.2):3.1,",
"Athene_noctua:7.3):6.3,Tyto_alba:13.5);",
file = "ex.tre", sep = "")
tree.owls <- read.tree("ex.tre")
str(tree.owls)
tree.owls
unlink("ex.tre") # delete the file "ex.tre"
### Only the first three species using the option `text'
TREE <- "((Strix_aluco:4.2,Asio_otus:4.2):3.1,Athene_noctua:7.3);"
TREE
tree.owls.bis <- read.tree(text = TREE)
str(tree.owls.bis)
tree.owls.bis
Run the code above in your browser using DataLab