Getting started with data in R

Key concepts that you will learn:

What are R and RStudio?

We will write code in R, a statistical programming language, using RStudio. RStudio is an “IDE” or an integrated development environment. Basically, if R is the engine of our (statistical programming) car, then RStudio is our dashboard, with all of the controls that we’d be more familiar with (plotting window, file visualization pane, help pane, etc.).

Image from Ismay et al. (2020)

How do I access RStudio?

Please start by logging into sso.posit.cloud/pomona. Once you’ve logged in, you should see the option to open the Conservation Biology Spring 2023 workspace. You can also access the Conservation Biology Spring 2023 workspace at this link.

At the workspace, you should then see the “Assignment” Week 1. Please click on that Assignment. Here is a direct link to the Week 1 project, but it may not work if this is the first time ever or in a while that you’re logging into posit.cloud. If it doesn’t work, no worries - just log in through the sso.posit.cloud/pomona link.

What does RStudio have anyway?

RStudio has 3 different panes:

Image from Bailey (2018)

What do each of these panes do?

Running your first R code!

Copy the code below into the console and hit enter. What do you see?

x <- c(1,2,3)
x

You should see the following:

## [1] 1 2 3

Congratulations! You have created your first object in R: a vector storing the numbers 1, 2, and 3.

You achieved that by using the assignment operator <- to tell R to create a new object, x, that stores the values 1, 2, and 3 in a vector, denoted by c(...) where the ... is just a placeholder for whatever you’d like to enter (where each element is separated by commas).

I encourage you to try the following: