HowTo/GettingStarted

From Comparative Phylogenetics in R
Revision as of 12:35, 11 December 2007 by Sds21 (talk)
Jump to: navigation, search

Comparative Methods in R How To

R is freely available statistical software, which can be run in various environments (MacOSX, Windows, Linux). For a general description of R, visit its its introductory page. To download R, go to its homepage and select one of the CRAN mirrors. Most users will want to choose a precompiled binary distributions for their system (Mac, Windows, Linux). For PC users, select the "base" subdirectory and download and run the setup program (.exe file). MAC users will download the .dmg file and double-click the icon to install the program.

In order to run comparative analyses in R, the user will need to download one or more additional packages. To install R packages, open R (by double-clicking the desktop icon, via the start menu for PC users, or within the applications folder for Mac users). The first window users will see is the R Console. Mac users can download packages via the Package Installer in the Packages & Data menu. PC users can download packages by selecting install packages from the Packages menu. Packages can also be downloaded by using the command line. To install ape, type at the command prompt > :

     install.packages("ape")

There are a large number of packages for phylogenetic and comparative analyses; a useful comparison of these packages and their functions has been compiled by Brian O'Meara (available here).


Many users will find it helpful to write a script containing their commands, so that the commands can be copied and pasted into the prompt instead of being typed in each time. R has a built-in editor that makes it easy to create and use scripts. For PC users, select New Script under the File menu. Commands typed into the scripts can be run by highlighting the commands in the script editor and using the CTRL+R or the Run Line or Selection button. Mac users can create scripts by opening a new document and can run commands by highlighting the commands and typing Apple+Return.