Skip to content

Commit d4e3133

Browse files
committed
Major update
1 parent 616507e commit d4e3133

File tree

71 files changed

+30274
-107873
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+30274
-107873
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
.Rdata
44
.httr-oauth
55
.DS_Store
6+
data-raw/dungfauna_occurrence.csv
7+
data-raw/dungfauna_event.csv

DESCRIPTION

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ Authors@R:
1212
role = "aut",
1313
email = "jake.manger@uwa.edu.au",
1414
comment = c(ORCID = "0000-0002-0686-4788")))
15-
Description: What the package does (one paragraph).
15+
Description: This is a data package with data on occurrence and abundance
16+
records for deliberately introduced dung beetles in Australia.
1617
License: CC BY 4.0
1718
Encoding: UTF-8
1819
Roxygen: list(markdown = TRUE)
@@ -26,19 +27,20 @@ Depends:
2627
LazyData: true
2728
Imports:
2829
directlabels (>= 2021.1.13),
29-
dplyr (>= 1.1.0),
30-
ggplot2 (>= 3.4.1),
30+
dplyr (>= 1.1.2),
31+
ggplot2 (>= 3.4.3),
3132
ggtext (>= 0.1.2),
32-
htmlwidgets (>= 1.5.4),
33+
htmlwidgets (>= 1.6.2),
3334
leafem (>= 0.2.0),
34-
leaflet (>= 2.1.1),
35+
leaflet (>= 2.1.2),
3536
leaflet.extras (>= 1.0.0),
3637
lubridate (>= 1.9.2),
3738
RColorBrewer (>= 1.1.3),
38-
scales (>= 1.2.0),
39+
scales (>= 1.2.1),
40+
sf (>= 1.0.14),
3941
shinyalert (>= 3.0.0),
4042
shinyjs (>= 2.1.0),
41-
shinyWidgets (>= 0.7.1),
42-
stringr (>= 1.5.0)
43-
Remotes:
44-
jakemanger/leaflet.extras
43+
shinyWidgets (>= 0.7.6),
44+
stars (>= 0.6.3),
45+
stringr (>= 1.5.0),
46+
tidyr (>= 1.3.0)

R/data.R

Lines changed: 75 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -2,67 +2,89 @@
22
#'
33
#' Within Australia, the next smaller administrative unit after country is
44
#' State / Territory, after which comes a 'Local Government Area'. These are
5-
#' equivalent to the Darwin Core terms stateProvince and county.
5+
#' equivalent to the Darwin Core terms stateProvince and county respectively.
6+
#' We have included these data within the package to aid with assigning the
7+
#' county, stateProvince, country and countryCode fields to the dung fauna data.
68
#'
79
#' The Australian Bureau of Statistics (ABS) provides shapefile data for local
810
#' government areas in Australia which also includes the associated higher
911
#' level geographies (State / Territory and Country). More information is here:
1012
#' \url{https://www.abs.gov.au/statistics/standards/australian-statistical-geography-standard-asgs-edition-3/jul2021-jun2026/access-and-downloads/digital-boundary-files}.
1113
#'
12-
#' The download link for the raw data is (Local Government Areas - 2022 -
13-
#' Shapefile in GDA2020):
14-
#' https://www.abs.gov.au/statistics/standards/australian-statistical-geography-standard-asgs-edition-3/jul2021-jun2026/access-and-downloads/digital-boundary-files/LGA_2022_AUST_GDA2020_SHP.zip
15-
"county_stateProvince_aus"
16-
17-
1814
#' The data downloaded from ABS has been slightly modified with empty geometries
1915
#' removed, terms renamed to Darwin Core terms, and not needed fields removed.
20-
#' @format An \code{sf} POLYGON object with 547 features and 4 fields:
16+
#'
17+
#' @format An \code{sf} MULTIPOLYGON object with 547 features and 4 fields:
2118
#' \describe{
22-
#' \item{datasetID}{\url{http://rs.tdwg.org/dwc/terms/datasetID}}
23-
#' \item{locationID}{\url{http://rs.tdwg.org/dwc/terms/locationID} The
24-
#' location identifier given in the data set.}
25-
#' \item{basisOfRecord}{\url{http://rs.tdwg.org/dwc/terms/basisOfRecord} We
26-
#' have included two values. "PreservedSpecimen" has been used where the
27-
#' record came from a trap collection. "HumanObservation" has been used where
28-
#' the record came from the supplementary survey.}
29-
#' \item{recordedBy}{\url{http://rs.tdwg.org/dwc/iri/recordedBy} All records
30-
#' were recorded by the Department of Primary Industries and Regional
31-
#' Development ("DPIRD")}
32-
#' \item{occurrenceStatus}{\url{http://rs.tdwg.org/dwc/iri/occurrenceStatus}
33-
#' Either "Present" or "Absent".}
34-
#' \item{samplingProtocol}{\url{http://rs.tdwg.org/dwc/terms/samplingProtocol}
35-
#' "CSIRO pitfall trap baited with 1kg dung" describes records from a trap
36-
#' collection. "Dung pads in paddock searched for dung beetles" describes
37-
#' records from the supplementary survey.}
38-
#' \item{scientificName}{\url{http://rs.tdwg.org/dwc/terms/scientificName}
39-
#' Sixteen levels, including 13 species level identifications (Bubas bison,
40-
#' Copris hispanus, Coelostoma australe, Euoniticellus fulvus, E. intermedius,
41-
#' E. pallipes, Heteronychus arator, Onitis alexis, Onitis aygulus,
42-
#' Onthophagus binodis, O. ferox, O. taurus, O. vermiculatus), two genus level
43-
#' identifications (Aphodius and Hister) and one subfamily level
44-
#' identification (Aphodiinae)}
45-
#' \item{identifiedBy}{\url{http://rs.tdwg.org/dwc/terms/identifiedBy} All
46-
#' specimens were identified by DPIRD staff or DPIRD contracted consultants}
47-
#' \item{verbatimEventDate}{
48-
#' \url{http://rs.tdwg.org/dwc/terms/verbatimEventDate} Date or date-time
49-
#' recorded by DPIRD. This is the date/date-time that the traps were collected
50-
#' or the human observation conducted. Note that not all records include the
51-
#' time. Times shown are in the local time zone (Australia/Perth)}
52-
#' \item{verbatimLatitude}{\url{http://rs.tdwg.org/dwc/terms/verbatimLatitude}
53-
#' The Latitude recorded by DPIRD. Note that at all trapping sites two traps
54-
#' were placed 10-20 m apart. For some locations/records the coordinates of
55-
#' the individual trap have been recorded, otherwise just one value for both
56-
#' traps is given.}
57-
#' \item{verbatimLongitude}{
58-
#' \url{http://rs.tdwg.org/dwc/terms/verbatimLongitude}
59-
#' The Longitude recorded by DPIRD.}
60-
#' \item{individualCount}{\url{http://rs.tdwg.org/dwc/terms/individualCount}
61-
#' Note that records from the supplementary survey have been assigned a
62-
#' count value of NA.}
63-
#' \item{occurrenceRemarks}{
64-
#' \url{http://rs.tdwg.org/dwc/terms/occurrenceRemarks} All NAs. Included
65-
#' here to match other data sets.}
19+
#' \item{county}{\url{http://rs.tdwg.org/dwc/terms/county} Local government
20+
#' areas in Australia, nested within stateProvince. The geometry provides the
21+
#' boundaries of these areas.}
22+
#' \item{stateProvince}{\url{http://rs.tdwg.org/dwc/terms/stateProvince} The
23+
#' State or Territory within which the county / local government area is
24+
#' located.}
25+
#' \item{country}{\url{http://rs.tdwg.org/dwc/terms/country} All features are
26+
#' within Australia}
27+
#' \item{countryCode}{\url{http://rs.tdwg.org/dwc/terms/countryCode} The code
28+
#' used for Australia}
29+
#' \item{geometry}{\url{http://rs.tdwg.org/dwc/terms/geometry} Multipolygons
30+
#' providing the boundaries for county / local government area.}
31+
#' }
32+
#' @source <https://www.abs.gov.au/statistics/standards/australian-statistical-geography-standard-asgs-edition-3/jul2021-jun2026/access-and-downloads/digital-boundary-files/LGA_2022_AUST_GDA2020_SHP.zip>
33+
"county_stateProvince_aus"
34+
35+
36+
#' A dataset of deliberately introduced dung beetle records (long format)
37+
#'
38+
#' These data provide counts of deliberately introduced dung beetles in
39+
#' Australia for 23 species and 10,272 sampling events with each row
40+
#' representing the data for one species from one sampling event. Column
41+
#' headings use the Darwin Core terms, except for column headings that include
42+
#' an underscore (_). In the latter case, the underscore has been included to
43+
#' indicate that a non Darwin Core term has been used.
6644
#'
45+
#' The data are fully documented in Berson et al (submitted).
46+
#'
47+
#' @format A data frame with 58 variables and 232,599 rows
48+
"dungfauna_occurrence"
49+
50+
51+
52+
#' A dataset of deliberately introduced dung beetle records (wide format)
53+
#'
54+
#' These data provide counts of deliberately introduced dung beetles in
55+
#' Australia for 10,272 sampling events with each row representing one
56+
#' sampling event. Column headings use the Darwin Core terms, except for columns
57+
#' showing species counts (columns from "Bubas bison" to "Sisyphus spinipes")
58+
#' and column headings that include an underscore (_). In the latter case, the
59+
#' underscore has been included to indicate that a non Darwin Core term has been
60+
#' used. The variables are as documented in Berson et al (submitted) except for
61+
#' the variables "Bubas bison" to "Sisyphus spinipes". See below under
62+
#' **Format**.
63+
#'
64+
#' The values in the columns "Bubas bison" to "Sisyphus spinipes"
65+
#' represent the number of individuals of the species collected by the method
66+
#' described in the column samplingProtocol, except where the value in
67+
#' eventRemarks is "Species counts are visual activity ratings". In the latter
68+
#' case the values range from 0 to 5, with 0 indicating the species was not
69+
#' found, and 5 indicating that the species was found in almost every dung pad
70+
#' searched.
71+
#'
72+
#' @format A data frame with 64 variables and 10,113 rows:
73+
#' \describe{
74+
#' \item{`Bubas bison`, `Copris elphenor`, `Copris hispanus`,
75+
#' `Digitonthophagus gazella`, `Euoniticellus africanus`,
76+
#' `Euoniticellus fulvus`, `Euoniticellus intermedius`,
77+
#' `Euoniticellus pallipes`, `Geotrupes spiniger`, `Liatongus militaris`,
78+
#' `Onitis alexis`, `Onitis aygulus`, `Onitis caffer`, `Onitis pecuarius`,
79+
#' `Onitis vanderkelleni`, `Onitis viridulus`, `Onthophagus binodis`,
80+
#' `Onthophagus nigriventris`, `Onthophagus obliquus`,
81+
#' `Onthophagus sagittarius`, `Onthophagus taurus`, `Sisyphus rubrus`,
82+
#' `Sisyphus spinipes`}{Either the number of individual specimens collected,
83+
#' or the activity level observed, for the given species during the sampling
84+
#' event. See **Details**}
6785
#' }
68-
"dpird_2012_2014"
86+
"dungfauna_event"
87+
88+
89+
90+

R/runShinyApp.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22
#' Run the shiny app visualisation
33
#'
44
#' Starts a visualisation of the dataset in a shiny app that can be
5-
#' viewed locally in the browser. After calling this function,
6-
#' If the app window doesn't start automatically,
7-
#' navigate to the port printed to your console
5+
#' viewed locally in the browser. If the app window doesn't start automatically,
6+
#' after calling this function, navigate to the port printed to your console
87
#' (usually [localhost:5197](localhost:5197)) in your web browser.
98
#'
109
#' @export
1110
#'
1211
#' @examples
1312
#' # start the visualisation with:
14-
#' dungfaunaR::runShinyApp()
13+
#' # dungfaunaR::runShinyApp()
1514
runShinyApp <- function() {
1615
appDir <- system.file("shiny-visualisation", "app", package = "dungfaunaR")
1716

1817
if (appDir == "") {
19-
stop("Could not find shiny app directory. Try re-installing `dungfaunaR`.", call. = FALSE)
18+
stop("Could not find shiny app directory. Try re-installing `dungfaunaR`.",
19+
call. = FALSE)
2020
}
2121

2222
shiny::runApp(appDir, display.mode = "normal")

README.Rmd

Lines changed: 20 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -13,53 +13,19 @@ knitr::opts_chunk$set(
1313
)
1414
```
1515

16-
# Quick guide
17-
18-
Once you have cloned the repository to your computer, open the project and run:
19-
20-
devtools::install()
21-
22-
This will install the package to your local library.
23-
24-
The data to use for the dashboard is:
25-
26-
data("dungfauna_aus")
27-
28-
These data contain records from DBEE, QLD and a WA project. Not for public release just yet.
29-
30-
There will be some further refinements to these data but I think we are at a stage to include a dashboard in the package.
31-
32-
So, the aim is to:
33-
34-
- 1. incorporate a copy of the dashboard into the package so that when a user installs the package they can run the dashboard locally.
35-
36-
- 2. update the dashboard so that it includes
37-
38-
* all species found in the scientificName column (there are now new species from the QLD and WA projects that will need to be added to the 'Select a species' menu)
39-
40-
* A new menu item allowing for data to be filtered by datasetName (i.e. project)
41-
42-
* Remove the prediction tab
43-
44-
* Put back in the data tab
45-
46-
* Turn off the jittering of points
47-
48-
* Any other minor changes we think of
16+
# dungfaunaR
4917

50-
**Note: this is not a replacement of the existing dashboard but a copy.**
5118

19+
## Overview
5220

21+
This is a data package with data on occurrence and abundance records for deliberately introduced dung beetles in Australia. Currently, the data contain `r (dungfaunaR::dungfauna_occurrence |> dplyr::summarise(sum(individualCount, na.rm = TRUE)) |> dplyr::pull() + dungfaunaR::dungfauna_occurrence |> dplyr::filter(occurrenceStatus == "present" & base::is.na(individualCount)) |> dplyr::count() |> dplyr::pull()) |> base::format(big.mark = ",")` species identifications from `r dungfaunaR::dungfauna_occurrence |> dplyr::filter(occurrenceStatus == "present") |> dplyr::count() |> dplyr::pull() |> base::format(big.mark = ",")` occurrence records, taken from `r dungfaunaR::dungfauna_event |> dplyr::count() |> dplyr::pull() |> base::format(big.mark = ",")` sampling events at `r dungfaunaR::dungfauna_event |> dplyr::distinct(locationID_site) |> dplyr::count() |> dplyr::pull() |> base::format(big.mark = ",")` locations. The data also contain `r dungfaunaR::dungfauna_occurrence |> dplyr::filter(occurrenceStatus == "absent") |> dplyr::count() |> dplyr::pull() |> base::format(big.mark = ",")` absence records. The data are explained in detail in Berson et al (submitted).
5322

23+
Code used to format the data can be found in the `data-raw folder` in the [dungfaunaR gihub repository](link here). Note that we formatted and performed checks on data from different projects separately (see `data-raw/qld_2001_2010.R`, `data-raw/dafwa_wa_2012_2014.R` and `data-raw/dbee_2019_2022.R`), before combining these data into one dataset (see `data-raw/dungfauna_aus.R`).
5424

55-
# dungfaunaR
25+
Code used to generate the summary statistics, figures and tables in Berson et al (submitted) can by found in the `data-paper` folder within the `data-raw` folder.
5626

57-
<!-- badges: start -->
58-
[![CRAN status](https://www.r-pkg.org/badges/version/dungfaunaR)](https://CRAN.R-project.org/package=dungfaunaR)
59-
[![Codecov test coverage](https://codecov.io/gh/jdberson/dungfaunaR/branch/master/graph/badge.svg)](https://app.codecov.io/gh/jdberson/dungfaunaR?branch=master)
60-
<!-- badges: end -->
27+
The data are provided in both wide (`dungfauna_event`) and long (`dungfauna_occurrence`) format. Running `dungfaunaR::runShinyApp()` will launch a shiny app for visually exploring the data.
6128

62-
The goal of dungfaunaR is to ...
6329

6430
## Installation
6531

@@ -70,27 +36,27 @@ You can install the development version of dungfaunaR from [GitHub](https://gith
7036
devtools::install_github("jdberson/dungfaunaR")
7137
```
7238

73-
## Example
39+
## Getting started
7440

75-
This is a basic example which shows you how to solve a common problem:
41+
After installing the package, the following code load the data into your R session:
7642

77-
```{r example}
43+
``` r
7844
library(dungfaunaR)
79-
## basic example code
80-
```
8145

82-
What is special about using `README.Rmd` instead of just `README.md`? You can include R chunks like so:
46+
# To load the data in wide format:
47+
data("dungfauna_event")
48+
49+
# To load the data in long format:
50+
data("dungfauna_occurrence")
8351

84-
```{r cars}
85-
summary(cars)
8652
```
8753

88-
You'll still need to render `README.Rmd` regularly, to keep `README.md` up-to-date. `devtools::build_readme()` is handy for this. You could also use GitHub Actions to re-render `README.Rmd` every time you push. An example workflow can be found here: <https://github.com/r-lib/actions/tree/v1/examples>.
54+
After installing and loading the package, you can explore the data with the built-in shiny app using `dungfaunaR::runShinyApp()`
8955

90-
You can also embed plots, for example:
56+
## Citation
9157

92-
```{r pressure, echo = FALSE}
93-
plot(pressure)
94-
```
58+
The paper detailing the data is currently submitted as a data paper. Please check back here for the correct citation to use when using the data.
59+
60+
## Issues
9561

96-
In that case, don't forget to commit and push the resulting figure files, so they display on GitHub and CRAN.
62+
If you find an error or a bug we would love to hear from you! Please let us know what you have found by creating an issue at https://github.com/jdberson/dungfaunaR/issues.

0 commit comments

Comments
 (0)