#TidyTuesday + WebR

WebR is a version of R that runs in the browser. You don’t need to install R and no one needs to setup a server. It just works - even your phone. This site lets you use it for this weeks Tidy Tuesday on long-term monitoring data on mammals from the Portal Project.

Data

The dataset is on the long-term dynamics of rodent species. It has three tables:

  • surveys - which has one row for each individual animal caught including where, when, and information on the individual (e.g., size)
  • species, which has one row for each species in the dataset
  • plots, which has one row per plot that tells you if the plot is a control plot or an exclosure plot where the dominant kangaroo rat species have been excluded.
head(surveys)
  censusdate month day year treatment plot stake species  sex reprod  age
1 1978-01-08     1   8 1978 exclosure    3    11      OL <NA>   <NA> <NA>
2 1978-01-08     1   8 1978 exclosure    3    22      NA <NA>   <NA> <NA>
3 1978-01-08     1   8 1978 exclosure    3    54      PF    M   <NA> <NA>
4 1978-01-08     1   9 1978   control   14    14      OT <NA>   <NA> <NA>
5 1978-01-08     1   9 1978   control   17    14      DM    M      Z <NA>
6 1978-01-08     1   9 1978   control   17    16      DM    F   <NA> <NA>
  testes vagina pregnant nipples lactation hfl wgt  tag note2 ltag note3
1   <NA>   <NA>     <NA>    <NA>      <NA>  NA  NA    0  <NA>    0  <NA>
2   <NA>   <NA>     <NA>    <NA>      <NA>  NA  NA    0  <NA>    0  <NA>
3      S   <NA>     <NA>    <NA>      <NA>  15   7    0  <NA>    0  <NA>
4   <NA>   <NA>     <NA>    <NA>      <NA>  NA  NA    0  <NA>    0  <NA>
5   <NA>   <NA>     <NA>    <NA>      <NA>  36  40 4872  <NA>    0  <NA>
6   <NA>      S     <NA>    <NA>      <NA>  34  37 4881  <NA>    0  <NA>
head(species)
  species           scientificname   taxa             commonname censustarget
1      BA          Baiomys taylori Rodent   Northern pygmy mouse            1
2      PB      Chaetodipus baileyi Rodent  Bailey's pocket mouse            1
3      PH     Chaetodipus hispidus Rodent    Hispid pocket mouse            1
4      PI  Chaetodipus intermedius Rodent      Rock pocket mouse            1
5      PP Chaetodipus penicillatus Rodent    Desert pocket mouse            1
6      DM       Dipodomys merriami Rodent Merriam's kangaroo rat            1
  unidentified rodent granivore minhfl  meanhfl maxhfl minwgt   meanwgt maxwgt
1            0      1         1      6 13.25065     15      6  9.449086     18
2            0      1         1     16 26.03125     47     10 31.873515     79
3            0      1         1     21 25.12821     28     18 30.717949     48
4            0      1         1     18 21.96262     24     10 17.466667     28
5            0      1         1     11 21.47861     27      4 17.618513     42
6            0      1         1     21 35.88389     50     13 43.527217     66
    juvwgt
1       NA
2 18.99505
3 24.00000
4 10.00000
5 11.66603
6 26.39258
head(plots)
  plot treatment
1    3 exclosure
2    4   control
3   11   control
4   14   control
5   15 exclosure
6   17   control

Let’s go!

There are three WebR-enabled pages on this site:

  1. Getting Started - will walk you through loading the data and installing packages in WebR
  2. Base R - gives you a Base R only setup with the data already loaded
  3. Tidyverse - gives you R + dplyr + ggplot2 and the data already loaded. This page takes about 20 seconds to load the packages

What is this magic?!?

If you want to see how all of this works you can checkout the GitHub repository for this site. The site uses Quarto with the Quarto WebR extension. Preloading data on the Base and Tidyverse pages requires a little bit of javascript.