Welcome to BIOL 204 Lab

Homework 1: Create a Posit Cloud Account and Familiarize Yourself with Its Setup

The R Programming Language

R is a programming language that is used to graph and statically analyze data. It has become very common among Biologists because it is free and open source. This semester, you will learn or extend your knowledge of programming in R. Follow the steps below to get started:

  1. We will be using the cloud-based R operating system called Posit Cloud, previously RStudio Cloud.
  2. You will need to create an account in Posit Cloud. Go to https://posit.cloud/ and create a free account.

Figure 1. Setting up a Posit Cloud account.

Once you have an account, you can start a new R Studio project.

Figure 2. Creating a new R Project and R Script in Posit Cloud.

The Editor window in Posit Cloud is where you write commands that you want to save. Formally, you write source code, which is called a script, hence the alternate names for the Editor window. The console, below the editor window, will run your code. This is where you will want to check for errors.

Figure 3. Layout of windows in R Studio after you open an R Script.

Basic Operators

The R console, in its most basic form, is a simple calculator that uses the same operators as Google sheets:

  • Addition: +
  • Subtraction: -
  • Division: /
  • Exponentiation: ^

In order to execute the code that you type, you must run the code by highlighting it and clicking the Run button, or, alternatively, placing the cursor on the line with the code and using the keyboard shortcuts Ctrl + Enter (Windows) or Cmd + Return (Mac).

Get into the habit of annotating (“commenting”) your code Comments will not only remind you what the code does, they will make your code understandable to others with whom you share your scripts. Comments are preceded by a hashtag (#) and do not affect the code when it is run.

Example code with comments and output to calculate the sum of 20 and 89.

#sum of 20 and 89
20+89
[1] 109

Make sure you have a Posit Cloud account and have tried running a line or two of basic math code in the editor window before coming into lab this week. Your instructor will send you a link to a shared workspace on Posit Cloud for all future homework and in-lab activities.