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()
.read.tree(file = "", format = "Newick", rooted = TRUE,
tree.names = NULL, skip = 0, comment.char = "#", ...)
file = ""
(the default) then
tree is input on the keyboard, the entry being terminated with a blank line."Newick"
. Currently only Newick is available.TRUE
. This is currently not implemented, meaning
that all trees are read as rooted.NULL
(the default) the trees are names "tree1", "tree2", ...scan()
."phylo"
with the following components:edge
.edge
.NULL
if not available in the file).c("phylo", "multi.tree")
, and is a list of objects of class "phylo"
.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"
Run the code above in your browser using DataLab