This notebook will demonstrate how to:

  • Navigate the RStudio environment
  • Use R for simple calculations, both mathematical and logical
  • Define and use variables in base R
  • Understand and apply base R functions
  • Understand, define, and use R data types, including vector manipulation and indexing
  • Understand the anatomy of a data frame

What is R?

R is a statistical computing language that is open source, meaning the underlying code for the language is freely available to anyone. You do not need a special license or set of permissions to use and develop code in R.

R itself is an interpreted computer language and comes with functionality that comes bundled with the language itself, known as “base R”. But there is also rich additional functionality provided by external packages, or libraries of code that assist in accomplishing certain tasks and can be freely downloaded and loaded for use.

In the next notebook and subsequent modules, we will be using a suite of packages collectively known as The Tidyverse. The tidyverse is geared towards intuitive data science applications that follow a shared data philosophy. But there are still many core features of base R which are important to be aware of, and we will be using concepts from both base R and the tidyverse in our analyses, as well as task specific packages for analyses such as gene expression.

What is RStudio?

RStudio is a graphical environment (“integrated development environment” or IDE) for writing and developing R code. RStudio is NOT a separate programming language - it is an interface we use to facilitate R programming. In other words, you can program in R without RStudio, but you can’t use the RStudio environment without R.

For more information about RStudio than you ever wanted to know, see this RStudio IDE Cheatsheet (pdf).

The RStudio Environment

The RStudio environment has four main panes, each of which may have a number of tabs that display different information or functionality. (their specific location can be changed under Tools -> Global Options -> Pane Layout).