From Comparative Phylogenetics in R
Revision as of 11:43, 11 December 2007 by Bls16 (talk)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The commands referenced below are all part of special phylogenetic packages in R, not the basic R install. Be sure that you have installed and loaded the packages containing the commands referenced below before continuing. For example:


This loads the package ape and its required packages gee, lattice and ade4 into your R session.

How do I input a phylogeny into R?

The package APE can read phylogenies in either Newick or NEXUS format using the read.tree and commands, respectively.

  MyTree <- read.tree("MyNewickTreefile.tre")
  MyTree <-"MyNexusTreefile.nex")

Either of these commands will create an identical object in R containing your tree. Taxon names should appear without quotes. Note that the NEXUS format supports the use of a translation table for taxon names.

How do I export a phylogeny out of R?

The package APE can export phylogenies in either Newick or Nexus format using the write.tree and commands, respectivly.

  write.tree(geospiza$geospiza.tree, file="geospiza.tre"$geospiza.tree, file="geospiza.nex"

How do I input data corresponding to the tips of my phylogeny into R?

First, assemble your data into a tab delimited text file (this can be done, for example, in a simple text editor or in MS Excel)

In what ways can I manipulate phylogenies in R?