Skip to content

Commit

Permalink
Remove filtering args in map_deployments()
Browse files Browse the repository at this point in the history
See #231
  • Loading branch information
damianooldoni committed Jul 22, 2024
1 parent d9976b7 commit 86f0404
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 138 deletions.
83 changes: 14 additions & 69 deletions R/map_deployments.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,7 @@
#' - `day`
#' - `month`
#' - `year`
#' If `NULL` (default), the effort is returned in hours.
#' @param sex Character defining the sex class to filter on, e.g. `"female"`.
#' If `NULL` (default) all observations of all sex classes are taken into
#' account.
#' Optional parameter for `n_obs` and `n_individuals`.
#' @param life_stage Character vector defining the life stage class to filter
#' on, e.g. `"adult"` or `c("subadult", "adult")`.
#' If `NULL` (default) all observations of all life stage classes are taken
#' into account.
#' Optional parameter for `n_obs` and `n_individuals`.
#' If `NULL` (default), the effort is returned in hours.
#' @param cluster Logical value indicating whether using the cluster option
#' while visualizing maps.
#' Default: `TRUE`.
Expand Down Expand Up @@ -129,70 +120,27 @@
#' species = "Anas platyrhynchos"
#' )
#'
#' # Show number of observations of subadult individuals of Anas strepera
#' map_deployments(
#' x,
#' "n_obs",
#' species = "Anas strepera",
#' life_stage = "subadult"
#' )
#'
#' # Show number of observations of female or unknown individuals of gadwall
#' map_deployments(
#' x,
#' "n_obs",
#' species = "gadwall",
#' sex = c("female", "unknown")
#' )
#'
#' # Show number of individuals (individuals of unidentified species included if
#' # any)
#' map_deployments(
#' x,
#' "n_individuals"
#' )
#'
#' # Same filters by life stage and sex as for number of observations apply
#' map_deployments(
#' x,
#' "n_individuals",
#' species = "Anas strepera",
#' sex = "female",
#' life_stage = "adult"
#' )
#'
#' # Show RAI
#' map_deployments(
#' x,
#' "rai",
#' species = "Anas strepera"
#' )
#'
#' # Same filters by life_stage and sex as for number of observations apply
#' map_deployments(
#' x,
#' "rai",
#' species = "Anas strepera",
#' sex = "female",
#' life_stage = "adult"
#' )
#'
#'
#' # Show RAI calculated by using number of detected individuals
#' map_deployments(
#' x,
#' "rai_individuals",
#' species = "Anas strepera"
#' )
#'
#' # Same filters by life stage and sex as for basic RAI apply
#' map_deployments(
#' x,
#' "rai_individuals",
#' species = "Anas strepera",
#' sex = "female",
#' life_stage = "adult"
#' )
#'
#' # Show effort (hours)
#' map_deployments(
#' x,
Expand Down Expand Up @@ -268,15 +216,11 @@
#' )
#'
#' # Same behavior for the icon visualizing NA values (`"n_species"` feature)
#' unknown_species_vs_no_obs <- x
#' unknown_species_vs_no_obs$data$observations <-
#' observations(unknown_species_vs_no_obs) %>%
#' # A deployment has detected only unknown species
#' filter(is.na(.data$scientificName) |
#' .data$scientificName != "Homo sapiens") %>%
#' # A deployment has no observations
#' filter(deploymentID != "62c200a9-0e03-4495-bcd8-032944f6f5a1")
#' # create new map
#' unknown_species_vs_no_obs <- x %>%
#' filter_observations(
#' is.na(scientificName) | scientificName != "Homo sapiens"
#' ) %>%
#' filter_deployments(deploymentID != "62c200a9-0e03-4495-bcd8-032944f6f5a1")
#' map_deployments(
#' unknown_species_vs_no_obs,
#' feature = "n_species",
Expand All @@ -287,12 +231,13 @@
#' )
#'
#' # Set size of the icon for zero values deployments
#' map_deployments(
#' x,
#' "n_obs",
#' life_stage = "subadult",
#' zero_values_icon_size = 30
#' )
#' x %>%
#' filter_observations(lifeStage == "subadult") %>%
#' map_deployments(
#' x,
#' "n_obs",
#' zero_values_icon_size = 30
#' )
#'
#' # Disable cluster
#' map_deployments(
Expand Down
81 changes: 12 additions & 69 deletions man/map_deployments.Rd

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

0 comments on commit 86f0404

Please sign in to comment.