Goal

Today we are going to be exploring the foundations of coding in R. As we move through this course, you will get experience with different things that R can do. For today, we want to start getting familiar with the set up and how to run codes using R.

Note: This lab assumes that you have already installed the software and gone through the RMarkdown tutorial. If you have not done so, make sure to do these before starting the lab.

The First Data Set

The first thing we need to start any analysis is data. We will work with data on a variety of subjects in this class, but to get started, we are going to look at a historical data set. In statistics, sometimes we work with data that is very recent and sometimes we work with data from the past to detect trends that might inform future decisions. For today, we are going to look at a data set that explores the number of discoveries that the World Almanac and Book of Facts designate as great discoveries each year from 1860 to 1959.

To load the data, you need to create a Code Chunk (chunk for short). Remember that to do that, you go to Code at the very upper left of your RMarkdown window and then choose Insert Chunk.

Once you have created your chunk, type the following inside and press play (the green triangle on the right hand side of the chunk).

data("discoveries")

Once you have pressed play, look at the upper right hand panel of your RStudio screen (your Environment tab). Do you see that you have an object called discoveries? This means that you have loaded the data set you need!

Viewing the Data

Now that we have the data loaded, let's answer our first lab question. Remember, to create a lab question you want to put two ## in your RMarkdown document, hit the space bar, and then type Question 1. This means you should see ## Question 1. Then, hit enter (or return if you are on a Mac) twice, and you are ready to answer the question!