R Hackathon 1/GettingStarted

From Phyloinformatics
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 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 distribution 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.

Most users run analyses in R using the command line. When you first open R (by double-clicking the desktop icon, via the start menu for PC users, or within the applications folder for Mac users), a console will appear with a command prompt (">") at the bottom. Users interact with R by typing commands at this prompt. Many of the basics of using R are covered on the R introduction page. In this wiki, we will describe the basic tasks involved in carrying out comparative analyses, such as inputting data and trees.

In order to run comparative analyses in R, the user will need to download one or more additional packages. 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 the package ape, for example, type at the command prompt:

     install.packages("ape")

The CRAN Task View page provides a useful introduction to the statisical packages applicable to various fields (find phylogenetic and comparative methods under Genetics). 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).

When new versions of packages are made available, you can update the version you have installed by typing

     update.packages()

Updates can also be carried out using the menus. Windows users can select Update Packages under the Packages menu, and Mac users can update using the update all button in the Package Installer window.