Before we can do today’s exercises we need to do something extra. We need to get access to some extra functions that aren’t available in “base” R. To do this we will load a package into R. In R packages are called libraries and a library is a collection of functions that are usually designed to do similar types of things (e.g., analyzing data in a particular way). In this case we are going to load a really “meta”-package (a package so big that it actually contains other packages) and this is called the
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✓ ggplot2 3.3.5 ✓ purrr 0.3.4 ## ✓ tibble 3.1.6 ✓ dplyr 1.0.7 ## ✓ tidyr 1.1.4 ✓ stringr 1.4.0 ## ✓ readr 2.1.0 ✓ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ── ## x dplyr::filter() masks stats::filter() ## x dplyr::lag() masks stats::lag()
Now don’t worry about the “conflicts” message - this isn’t an error. (TL;DR: all this means is that some functions in the tidyverse are going to take precedence over functions with the same name in base R.). You can find out more about the tidyverse at their webpage.
Now you’ve got two tasks:
I will remind you how to do #s 1 and 2 in my video.
Now that we are in the right place, let’s read in the data, but this time we are going to use a function from the tidyverse that works with tab-separated values (files ending
## Rows: 6 Columns: 7
## ── Column specification ──────────────────────────────────────────────────────── ## Delimiter: "\t" ## chr (1): sample ## dbl (6): conc_uM, rep1, rep2, rep3, rep4, rep5
## ## ℹ Use `spec()` to retrieve the full column specification for this data. ## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
I will tell you a little bit about that object (which is called a “tibble”) in the video and show you a few tricks to view the data in different ways.
Did you notice how each replicate is a separate column? Let’s start by drawing a graph with the concentration column (on the x axis) and the first replicate (on the y axis):
plot(x = phosphate$conc_uM, y = phosphate$rep1)