Data dashboard: Butterfly species richness in Los Angeles

Web application Open Materials

Abstract

Dashboard presenting open data from Prudic et al. (2018), who compared three ways of recording butterfly species richness in Los Angeles: Pollard walks by trained volunteers, Malaise traps with expert identification and crowd-sourced iNaturalist observations. The coding involved reshaping the data to a long format, merging data sets and, as ever, wrangling with the layout of a table.



This dashboard presents open data (iNaturalist and BioSCAN) from Prudic et al. (2018). The authors compared three ways of recording butterfly species richness in Los Angeles: Pollard walks by trained volunteers, Malaise traps with expert identification (both recorded in the BioSCAN data) and crowd-sourced iNaturalist observations.

I developed this dashboard after reproducing the analyses of the original study in a ReproHack session.

How It Works

The diagram below shows how the three sources of data are combined in R before they reach the dashboard.

graph TD A["Open data from
Prudic et al. (2018)"] --> B["iNaturalist
(crowd-sourced observations)"] A --> C["BioSCAN
(Pollard walks and Malaise traps)"] A --> W["Species data
(wingspans)"] B --> D["Reshape, merge
and wrangle in R"] C --> D W --> D D --> E["Dashboard: butterfly species
richness in Los Angeles"]

My coding tasks included transforming the data to a long format,

# There are pseudovariables, that is, observations entered as variables. 
# Since most R processes need the tidy format, convert below 
# (see https://r4ds.had.co.nz/tidy-data.html). The specific numbers 
# found through Pollard walks and Malaise traps are preserved.

BioScan = BioScan %>% pivot_longer(
    cols = Anthocharis_sara:Vanessa_cardui, names_to = "Species",
    values_to = "Number", values_drop_na = TRUE
  )

# Compare
#str(BioScan)
#str(dat)
# 928 rows now; the result of 29 pseudovariables being transposed 
# into rows, interacting with 32 previous rows, i.e., 29 * 32 = 928.

merging three data sets,

# The iNaturalist data set presents a challenge that differs from the 
# pseudovariables found above. The number of animals of each species 
# must be computed from repeated entries, per site.

iNaturalist = merge(iNaturalist, 
                    iNaturalist %>% 
                      count(species, site, name = 'Number'))

and, as ever, wrangling with the layout of the dashboard pages to preserve the format of a table.

Species details {style="background-color: #FCFCFC;"}
=======================================================================

Column {style="data-width:100%; position:static; height:1000px;"}
-----------------------------------------------------------------------

References

Prudic, K. L., Oliver, J. C., Brown, B. V., & Long, E. C. (2018). Comparisons of citizen science data-gathering approaches to evaluate urban butterfly diversity. Insects, 9(4), Article 186. https://doi.org/10.3390/insects9040186

Comments are provided by Disqus and are not loaded automatically. Loading them connects your browser to Disqus, which may use cookies and process data under its privacy policy. See this site's privacy notice for details.