Back to Homepage

# Introduction to R

## Tutorial objectives

The objectives of this tutorial are to:

• Learn the basics of R including:
• basic mathmatical functions
• variable assignment
• installing packages
• Be introduced to data visualization

The first step is to download and install R, which is freely available and can be accessed here. You can choose any of the “mirrors” you want, but it is best to use the one that is closest to you geographically (e.g., the one at Oregon State University).

The second step is to download and install Rstudio, which is a very nice integrated development environment (IDE) for R. In a nutshell, it makes working with R much easier. You will want to install the Rstudio Desktop version that is appropriate for your operating system. After you have installed R and Rstudio, you can proceed to the next step.

## Getting started with R

R is a programming language that was developed to help researchers analyze quantitative data (e.g., do statistics). As such, R can be used for conducting both simple mathematical functions and complex statistical analyses. See below for some of the simple things that you can do with R. Note that any code directly preceded with a “#” is ignored by R.

``1+2``
``## [1] 3``

### multiplication:

``5*4``
``## [1] 20``

### division:

``18/32``
``## [1] 0.5625``

### power calculations:

``5^2``
``## [1] 25``