1. Getting Started
- Page ID
Don't be afraid! You don't have to be a master computer-programmer to work with R; it is very flexible and uses syntax that is simple and intuitive.
Where to Get R?
To download R, go to www.cran.r-project.org. Click on the link to download for your specific computer.
How do I use R?
To use R, you will want to use RStudio, an integrated development environment. To download, go to www.rstudio.com/products/rstudio/ and choose "RStudio Desktop".
There are 4 main components to RStudio:
The built-in text editor for writing scripts. Always write code in the source panel so that you can save it.
Where commands are entered and output is printed.
Environment & History
An interactive list of all loaded objects and a list of keystrokes entered into the console.
Files, Plots, Packages, Help:
Where you can navigate C drive files, find output for plots, search for and install packages, and output for help commands.
Using a darker background and a larger font in RStudio will help reduce eye strain. See the image below for instructions.
Starting a Project
To start a project, first, you must create a script.
Code in R
After creating a new R script, you will have to write in code to perform the actions you wish to complete your statistical analyses.
- To run code in R, type into each line the command/argument you want to run and use command (⌘) + enter. (For PC, use control + enter).
- Functions are always followed by parentheses. A common mistake is forgetting a close parenthesis!
- To run multiple lines of code, highlight the section then use command (⌘) + enter.