About the Data

Get acquainted with the data used in the course and read it using R.

Let’s introduce you to working with and manipulating data in R, exploring data, and plotting. We believe in learning by doing, so let’s start doing some things so that you can start learning.

The Resource-by-Predation dataset

This course uses data from an experiment that was conducted by a postdoctoral researcher at the Smithsonian Tropical Research Institute in Panama in 2010 and was published in the journal Ecology in 2013. The data is called by the short name RxP. This stands for “Resource by Predation,” which was the nature of the experiment as the study was referring to the interaction of resources and predators. This calls for a reiteration of a small but important point: since R is entirely based on typing commands by hand, we should give our datasets and variables short names so that they’re quick and easy to type.

First, let’s get a handle on what the data are.

The RxP data

  • The experiment consisted of 96 400-liter mesocosm tanks (artificial ponds) arrayed in an open field in the northwest corner of a small town in Panama called Gamboa. This is where the Smithsonian runs a field station for tropical research. We wanted to know how variations in the hatching of a frog embryo may affect its development to metamorphosis under various combinations of predators and resources.

  • The experimental treatments were as follows:

    • Hatching age: Early (four days post-oviposition) or late (six days post-oviposition)

    • Predators: Control, Nonlethal (caged) dragonfly larvae, or lethal (free-swimming) dragonfly larvae

    • Resources: Low (0.75 g) or high (1.5 g) food level, added every five days

  • The mesocosms were spatially arranged in eight blocks of 12 tanks each. The three treatments were “fully crossed”, meaning that each possible combination of treatments was created (for example, Tank 1 may be early hatching, control predator, and low resources, whereas Tank 2 may be late hatching, control predator, and low resources). The replicates were fully balanced across blocks and randomized within each block. Thus, each block consisted of one tank from each of the 12 unique treatment combinations, but within each block, the physical setup of tanks in the field was randomly assigned. Each tank began with 50 tadpoles, and the experiment ended when all the tadpoles reached their metamorphosis stage or had died.

  • Metamorphosis is a process that takes time. This process is generally defined as starting when a froglet’s arms erupt from its body (they first develop under the skin) and ending when the tail is fully resorbed into the body. The froglet may choose to leave the water early or late during this process. Thus, several measurements were taken when a froglet first left the water and several more when the tail was fully resorbed. At metamorphosis, we measured the following response variables:

    • Age at hatching, both in terms of time since eggs were oviposited and time since the very first froglet crawled out of the water (defined as Day 1).

    • Snout-vent length at emergence, which is the length from the tip of the froglet’s nose to its cloaca.

    • Tail length at emergence.

    • Snout-vent length after tail resorption.

    • Mass after tail resorption.

    • Number of days needed for each metamorphose to resorb the tail fully.

  • During the experiment, disease broke out in 18 of the mesocosms containing Nonlethal predators, and those tanks were removed from the dataset.

Reading the data file using read.csv()

There are several options for reading a data file, below is the straightforward way of doing it.

Get hands-on with 1400+ tech skills courses.