# install.packages("librarian")
::shelf(lter/lterdatasampler, tidyverse) librarian
Example Data
The lterdatasampler
R Package
The Long Term Ecological Research program (LTER) Network has recently created an R package containing example datasets from some of the LTER sites called lterdatasampler
. The goal of lterdatasampler
is to provide tidy versions of datasets from LTER sites for use in teaching and training contexts (like this workshop!). Eventually this package will contain datasets from each of the 28 extant LTER sites so be sure to check back often for updates as those data are integrated.
For this workshop, we’ll be using one of the datasets in this package to give our apps something to work with. Let’s explore that more fully below.
Andrews Forest Data
Specifically, we’ll be using the Andrews Forest (“AND”) LTER data. This dataset contains the length and width measurements of Cutthroat trout and salamanders found in Mack Creek at Andrews Forest.
To access this data, we’ll need to install the lterdatasampler
dataset and we’ll also want both the tidyverse
and librarian
packages as well (for data wrangling and package installation convenience respectively).
Once we have the packages that we need, we can retrieve the data and take a look at it.
# Load the data from AND
<- lterdatasampler::and_vertebrates
and_data
# Take a quick look at it
::glimpse(and_data) dplyr
Rows: 32,209
Columns: 16
$ year <dbl> 1987, 1987, 1987, 1987, 1987, 1987, 1987, 1987, 1987, 1987…
$ sitecode <chr> "MACKCC-L", "MACKCC-L", "MACKCC-L", "MACKCC-L", "MACKCC-L"…
$ section <chr> "CC", "CC", "CC", "CC", "CC", "CC", "CC", "CC", "CC", "CC"…
$ reach <chr> "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L"…
$ pass <dbl> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1…
$ unitnum <dbl> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2…
$ unittype <chr> "R", "R", "R", "R", "R", "R", "R", "R", "R", "R", "R", "R"…
$ vert_index <dbl> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1, …
$ pitnumber <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
$ species <chr> "Cutthroat trout", "Cutthroat trout", "Cutthroat trout", "…
$ length_1_mm <dbl> 58, 61, 89, 58, 93, 86, 107, 131, 103, 117, 100, 127, 99, …
$ length_2_mm <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
$ weight_g <dbl> 1.75, 1.95, 5.60, 2.15, 6.90, 5.90, 10.50, 20.60, 9.55, 13…
$ clip <chr> "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "NONE", "N…
$ sampledate <date> 1987-10-07, 1987-10-07, 1987-10-07, 1987-10-07, 1987-10-0…
$ notes <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
AND Data Dictionary
Information about the data in AND can be accessed by running ?and_vertebrates
but for simplicity’s sake, the columns and their meanings are recapitulated here as well.
year
– number – observation yearsitecode
– character – abbreviated name of sample areasection
– character – section of Mack Creek CC = clear cut forest, OG = old growth forest upstreamreach
– character – reach sampled from each section; L = lower reach (0 - 50 meters), M = middle reach (50 - 100 meters), U = upper reach (100 - 150 meters))pass
– number – electroshocking pass number, either 1 or 2unitnum
– number – channel unit numberunittype
– character – channel unit classification type (C = cascade, I = riffle, IP = isolated pool (not connected to channel), P = pool, R = rapid, S = step (small falls), SC = side channel, NA = not sampled by unit)vert_index
– number – unique index for each vertebratepitnumber
– number – unique tag number embedded into vertebrate (tagging started in 2007)species
– character – species measuredlength_1_mm
– number – vertebrate length in millimeters; total or snout-fork length for trout, and snout-vent length for salamanderslength_2_mm
– number – snout-tail length in millimeters (for Coastal giant salamander only)weight_g
– number – vertebrate mass in gramsclip
– character – fin clip type for cutthroat trout, ended in 2006 (LV = left ventral fin; LVRV = left and right ventral fins; RV = right ventral fin; NONE = no ventral fin clip)sampledate
– date – date of observationnotes
– character – additional comments
We may not use all of these columns today but your app could rely on any of them that you so choose!