Data dashboard: Butterfly species richness in Los Angeles
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
This dashboard presents open data (iNaturalist and BioScan) from Prudic, K.L.; Oliver, J.C.; Brown, B.V.; Long, E.C. Comparisons of Citizen Science Data-Gathering Approaches to Evaluate Urban Butterfly Diversity. Insects 2018, 9, 186. In their study, Prudic and colleagues compared citizen science with traditional methods in the measurement of butterfly populations.
I developed this dashboard after reproducing the analyses of the original study in a Reprohack session.
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 traps and crowdsourcing methods 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 pseudo-variables being transposed into # rows, interacting with 32 previous rows, i.e., 29 * 32 = 928.
merging three data sets,
# The iNaturalist data set presents a slightly different challenge 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 format 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;"} -----------------------------------------------------------------------
Reference
Bernabeu, P. (2020). Dashboard with data from Prudic, Oliver, Brown, & Long (2018), Comparisons of Citizen Science Data-Gathering Approaches to Evaluate Urban Butterfly Diversity, Insects, 9, 186. https://pablobernabeu.github.io/dashboards/Butterfly-species-richness-in-LA/d.html.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.