Skip to content

Commit

Permalink
clarify how weeks are defined, add category
Browse files Browse the repository at this point in the history
  • Loading branch information
mstrimas committed Apr 8, 2024
1 parent 299fe6f commit 9d188a4
Show file tree
Hide file tree
Showing 26 changed files with 105 additions and 72 deletions.
16 changes: 11 additions & 5 deletions R/process_barcharts.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,25 @@
#' proportion of checklists in the region that reported the species in the
#' given week and `n_detections` gives the number of detections. The total
#' number of checklists in each week used to estimate detection frequency is
#' provided as a data frame stored in the `sample_sizes` attribute.
#' provided as a data frame stored in the `sample_sizes` attribute. Note that
#' since most months have more than 28 days, the first three weeks have 7
#' days, but the final week has between 7-10 days.
#'
#' @export
#' @family helpers
#' @examples
#' # example bar chart data for svalbard
#' f <- system.file("extdata/barchart-sample.txt", package = "auk")
#' # import and process barchart data
#' barchart <- process_barcharts(f)
#' head(barchart)
#' barcharts <- process_barcharts(f)
#' head(barcharts)
#'
#' # the sample sizes for each week can be access with
#' attr(barchart, "sample_sizes")
#' attr(barcharts, "sample_sizes")
#'
#' # bar charts include data for non-species taxa
#' # use category to filter to only species
#' barcharts[barcharts$category == "species", ]
process_barcharts <- function(filename) {
stopifnot(is.character(filename), file.exists(filename))

Expand Down Expand Up @@ -74,7 +80,7 @@ process_barcharts <- function(filename) {

# add in species codes
tax <- auk::ebird_taxonomy
tax <- tax[, c("species_code", "common_name", "scientific_name")]
tax <- tax[, c("species_code", "common_name", "scientific_name", "category")]
detfrq <- dplyr::inner_join(tax, detfrq, by = "common_name")

# add in num detections
Expand Down
12 changes: 6 additions & 6 deletions docs/articles/auk.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ pkgdown_sha: ~
articles:
auk: auk.html
development: development.html
last_built: 2024-04-08T16:16Z
last_built: 2024-04-08T16:36Z

4 changes: 2 additions & 2 deletions docs/reference/auk_bbox.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/reference/auk_bcr.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/auk_breeding.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/auk_complete.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/reference/auk_country.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/reference/auk_county.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9d188a4

Please sign in to comment.