From ape v2.2-4
0th

Percentile

##### Read Tree File in Parenthetic Format

This function reads a file which contains one or several trees in parenthetic format known as the Newick or New Hampshire format.

Keywords
manip, IO
##### Usage
read.tree(file = "", text = NULL, tree.names = NULL,
skip = 0, comment.char = "#", ...)
##### Arguments
file
a file name specified by either a variable of mode character, or a double-quoted string; if file = "" (the default) then the tree is input on the keyboard, the entry being terminated with a blank line.
text
alternatively, the name of a variable of mode character which contains the tree(s) in parenthetic format. By default, this is ignored (set to NULL, meaning that the tree is read in a file); if text is not NULL
 tree.names if there are several trees to be read, a vector of mode character that gives names to the individual trees; if NULL (the default), the trees are named "tree1", "tree2", ... skip the number of lines of the input file to skip before beginning to read data (this is passed directly toscan()). comment.char a single character, the remaining of the line after this character is ignored (this is passed directly to scan()). ... Further arguments to be passed to scan(). 
 
 Details The default option for 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' tries to represent correctly trees with a badly represented root edge (i.e. with an extra pair of parentheses). For instance, the tree "((A:1,B:1):10);" will be read like "(A:1,B:1):10;" but a warning message will be issued in the former case as this is apparently not a valid Newick format. If there are two root edges (e.g., "(((A:1,B:1):10):10);"), then the tree is not read and an error message is issued. Value an object of class "phylo" with the following components:edgea two-column matrix of mode numeric where each row represents an edge of the tree; the nodes and the tips are symbolized with numbers; the tips are numbered 1, 2, ..., and the nodes are numbered after the tips. For each row, the first column gives the ancestor.edge.length(optional) a numeric vector giving the lengths of the branches given by edge.tip.labela vector of mode character giving the names of the tips; the order of the names in this vector corresponds to the (positive) number in edge.Nnodethe number of (internal) nodes.node.label(optional) a vector of mode character giving the names of the nodes.root.edge(optional) a numeric value giving the length of the branch at the root if it exists.If several trees are read in the file, the returned object is of class "multiPhylo", and is a list of objects of class "phylo". References Felsenstein, J. The Newick tree format. http://evolution.genetics.washington.edu/phylip/newicktree.html Olsen, G. Interpretation of the "Newick's 8:45" tree format standard. http://evolution.genetics.washington.edu/phylip/newick_doc.html Paradis, E. (2008) Definition of Formats for Coding Phylogenetic Trees in R. http://ape.mpl.ird.fr/misc/FormatTreeR_28July2008.pdf See Also write.tree, read.nexus, write.nexus, scan for the basic R function to read data in a file Aliases read.tree Examples ### 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 Documentation reproduced from package ape, version 2.2-4, License: GPL (>= 2) Community examples Looks like there are no examples yet. Post a new example: 
 
 
 R package Rdocumentation.org Created by DataCamp.com 
 Put your R skills to the test MathJax.Hub.Config({ messageStyle: "none", jax: ["input/TeX","output/CommonHTML"], extensions: ["tex2jax.js","MathMenu.js","MathZoom.js"], TeX: { extensions: ["AMSmath.js","AMSsymbols.js","noErrors.js","noUndefined.js"] }, tex2jax: { inlineMath: [ ['$','$'], ['\$','\$'] ], displayMath: [ ['$$','$$'] ], processEscapes: true, preview: 'none' } }); var $jq = jQuery.noConflict(); ;(function(p,l,o,w,i,n,g){if(!p[i]){p.GlobalSnowplowNamespace=p.GlobalSnowplowNamespace||[]; p.GlobalSnowplowNamespace.push(i);p[i]=function(){(p[i].q=p[i].q||[]).push(arguments) };p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o)[0];n.async=1; n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//cdn.datacamp.com/sp/2.10.2.js","snowplow")); var options = { appId: 'rdocumentation', platform: 'web', post: true, discoverRootDomain: true, contexts: { webPage: true, performanceTiming: true } }; options.forceSecureTracker = true; options.postPath = '/spevent'; window.snowplow('newTracker', 'co', "www.datacamp.com", options); window.snowplow('enableActivityTracking', 10, 10); // Ping every 10 seconds after 10 seconds window.snowplow('enableLinkClickTracking'); window.snowplow('trackPageView', null, [ { schema: 'iglu:com.datacamp/user/jsonschema/1-0-0', data: { anonId:$jq.cookie('dc_aid'), } } ]); var config = { forms: { whitelist: ["snowplow_tracked"] }, fields: { blacklist: ['password', 'password_confirmation'] } }; window.snowplow('enableFormTracking', config); (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-41577880-1', 'rdocumentation.org'); ga('send', 'pageview');