-
Download and install R, a free software environment for statistical computing and graphics from CRAN, the Comprehensive R Archive Network. It is highly recommended to install a precompiled binary distribution for your operating system -- use the links up at the top of the CRAN page linked to above!
-
Install RStudio's IDE (stands for integrated development environment), a powerful user interface for R: http://www.rstudio.com/ide/download/
-
Do whatever is appropriate for your OS to launch RStudio. You should get a window similar to the screenshot you see here, but yours will be more boring because you haven't written any code or made any figures yet!
-
Put your cursor in the pane labelled Console, which is where you interact with the live R process. Create a simple object with code like
x <- 2 * 4
(followed by enter or return). Then inspect thex
object by typingx
followed by enter or return. Obviously you should see the value 8 print to screen. If yes, you are good to go.
R is an extensible system and many people share useful code they have developed as a package via CRAN and github. To install a package from CRAN, for example the plyr
package for data aggregation, here is one way to do it in the R console (there are others).
install.packages("plyr", dependencies = TRUE)
We will use this package soon, so go ahead and install it!
Another package we will use soon is knitr
, which facilitates the creation of dynamic reports. You can install it in the same way.
install.packages("knitr", dependencies = TRUE)
The above will get your basic setup ready but here are some links if you are interested in reading a bit further.
- How to Use RStudio:
- RStudio Public Discussion & Troubleshooting Guide:
- R Installation and Administration
- R FAQ:
- More about add-on packages in the R Installation and Administration Manual