Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add verbose in get_dep_no_obs() #357

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion R/get_n_individuals.R
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ get_n_individuals <- function(package = NULL,

deployments_no_obs <- get_dep_no_obs(
package,
pred_in("deploymentID", deploymentID)
pred_in("deploymentID", deploymentID),
verbose = FALSE
)

# get number of individuals collected by each deployment for each species
Expand Down
3 changes: 2 additions & 1 deletion R/get_n_obs.R
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ get_n_obs <- function(package = NULL,

deployments_no_obs <- get_dep_no_obs(
package,
pred_in("deploymentID", deploymentID)
pred_in("deploymentID", deploymentID),
verbose = FALSE
)

# get number of observations collected by each deployment for each species
Expand Down
3 changes: 2 additions & 1 deletion R/get_n_species.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ get_n_species <- function(package = NULL,
# get deployments without observations among the filtered deployments
deployments_no_obs <- get_dep_no_obs(
package,
pred_in("deploymentID", deployments$deploymentID)
pred_in("deploymentID", deployments$deploymentID),
verbose = FALSE
)

# get species detected by each deployment after filtering
Expand Down
5 changes: 4 additions & 1 deletion R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ labelFormat_scale <- function(max_scale = NULL,
#'
#' @param package Camera trap data package object, as returned by
#' `read_camtrap_dp()`.
#' @param verbose Show (`TRUE`) or not (`FALSE`) the deployments
#' without observations.
#' @param datapkg Deprecated. Use `package` instead.
#' @param ... Filter predicates for filtering on deployments
#' @return A tibble data frame with deployments not linked to any observations.
Expand All @@ -185,6 +187,7 @@ labelFormat_scale <- function(max_scale = NULL,
#' get_dep_no_obs(mica)
get_dep_no_obs <- function(package = NULL,
...,
verbose = TRUE,
datapkg = lifecycle::deprecated()) {

# check input camera trap data package
Expand All @@ -208,7 +211,7 @@ get_dep_no_obs <- function(package = NULL,
dep_no_obs_ids <- dep_no_obs$deploymentID
n_dep_no_obs <- length(dep_no_obs_ids)

if (n_dep_no_obs > 0) {
if (n_dep_no_obs > 0 && verbose) {
max_print <- 20
# Suppress long messages
if (length(dep_no_obs_ids) > max_print) {
Expand Down
11 changes: 0 additions & 11 deletions tests/testthat/test-map_dep.R
Original file line number Diff line number Diff line change
Expand Up @@ -140,17 +140,6 @@ test_that("map_dep() can calculate and get feature values", {
" and\\1",
paste(no_obs_deployments, collapse = ", ")
)
suppressMessages(expect_message(
map_dep(mica, feature = "rai", species = "krakeend"),
glue::glue("There are 3 deployments without observations: {no_obs_deployments_str}"),
fixed = TRUE
))

suppressMessages(expect_message(
map_dep(mica, feature = "rai_individuals", species = "krakeend"),
glue::glue("There are 3 deployments without observations: {no_obs_deployments_str}"),
fixed = TRUE
))
expect_warning(
map_dep(mica, feature = "n_species", species = "krakeend"),
"`species` ignored for `feature = n_species`",
Expand Down
Loading