diff --git a/R/data.R b/R/data.R index de2fd62e..03b399cb 100644 --- a/R/data.R +++ b/R/data.R @@ -979,6 +979,8 @@ ##' Report. 2022/034. ##' https://www.dfo-mpo.gc.ca/csas-sccs/Publications/SAR-AS/2022/2022_034-eng.html ##' +##' See also: `harbour_seals_data_final_year` for the year of the final data for +##' each region. ##' @format A tibble also of class `pacea_harbour_seals` with columns: ##' \describe{ ##' \item{date:}{Date of the GAM estimate of abundance; there is a time step @@ -1009,7 +1011,7 @@ ##' Final year of Pacific Harbour Seals survey in each of seven regions ##' -##' Used for colouring the plots of the estimates contained in `harbour_seals` +##' Used for understanding the final year of data for the estimates contained in `harbour_seals` ##' (since some are projections beyond the data). Also see `?harbour_seals`. ##' ##' @format A tibble with columns: diff --git a/R/plot-pacea-harbour-seals.R b/R/plot-pacea-harbour-seals.R index d244cf1e..ff1532aa 100644 --- a/R/plot-pacea-harbour-seals.R +++ b/R/plot-pacea-harbour-seals.R @@ -29,7 +29,6 @@ ##' @param median_line_col col for median ##' @param median_line_lty lty for median ##' @param median_line_lwd lwd for median -##' @param ... further options passed onto `plot.default()` ##' @inherit plot.pacea_index ##' @return plot of the time series as median with bars showing uncertainty (if ##' `low` and `high` are columns of `obj) to the current device; returns nothing. @@ -59,9 +58,7 @@ plot.pacea_harbour_seals <- function(obj, median_pch = 16, median_line_col = "black", median_line_lty = 1, - median_line_lwd = 2, - ... # pass onto default plot - ){ + median_line_lwd = 2){ stopifnot("value must be a column of the object in the first argument" = value %in% names(obj)) diff --git a/man/harbour_seals.Rd b/man/harbour_seals.Rd index 383c3168..3e2e6fae 100644 --- a/man/harbour_seals.Rd +++ b/man/harbour_seals.Rd @@ -65,6 +65,9 @@ DFO. 2022. Stock Assessment of Pacific Harbour Seals (\emph{Phoca vitulina richa 2019. DFO Canadian Science Advisory Secretariat Science Advisory Report. 2022/034. https://www.dfo-mpo.gc.ca/csas-sccs/Publications/SAR-AS/2022/2022_034-eng.html + +See also: `harbour_seals_data_final_year` for the year of the final data for + each region. } \examples{ \dontrun{ diff --git a/man/harbour_seals_data_final_year.Rd b/man/harbour_seals_data_final_year.Rd index ad5ff060..ba4caf2d 100644 --- a/man/harbour_seals_data_final_year.Rd +++ b/man/harbour_seals_data_final_year.Rd @@ -16,7 +16,7 @@ A tibble with columns: harbour_seals_data_final_year } \description{ -Used for colouring the plots of the estimates contained in `harbour_seals` +Used for understanding the final year of data for the estimates contained in `harbour_seals` (since some are projections beyond the data). Also see `?harbour_seals`. } \examples{ diff --git a/man/plot.pacea_harbour_seals.Rd b/man/plot.pacea_harbour_seals.Rd index ae096b23..a596a4ad 100644 --- a/man/plot.pacea_harbour_seals.Rd +++ b/man/plot.pacea_harbour_seals.Rd @@ -22,8 +22,7 @@ median_pch = 16, median_line_col = "black", median_line_lty = 1, - median_line_lwd = 2, - ... + median_line_lwd = 2 ) } \arguments{ @@ -75,8 +74,6 @@ means not medians)} \item{median_line_lty}{lty for median} \item{median_line_lwd}{lwd for median} - -\item{...}{further options passed onto `plot.default()`} } \value{ plot of the time series as median with bars showing uncertainty (if diff --git a/tests/testthat/test-plot-time-series.R b/tests/testthat/test-plot-time-series.R index 499cbb61..93421b9b 100644 --- a/tests/testthat/test-plot-time-series.R +++ b/tests/testthat/test-plot-time-series.R @@ -1,4 +1,5 @@ -# These are on plotting functions for pacea_index and then pacea_recruitment and pacea_biomass objects. +# These are on plotting functions for pacea_index and then pacea_recruitment, +# pacea_biomass, pacea_buoy, and pacea_harbour_seals objects. test_that("index plotting: the stopifnot commands are working", { expect_error(plot(oni, @@ -91,3 +92,20 @@ test_that("buoy SST plotting works with various options", { years = 2010:2020)) expect_error(plot(buoy_sst, stn_id = c("C46004", "C46036"))) }) + +# plot.pacea_harbour_seals() +test_that("harbour seals plotting works with various options", { + expect_visible(plot(harbour_seals)) + expect_invisible(plot(harbour_seals, + region = "SOG")) + expect_error(plot(harbour_seals, + region = "nonsense")) + expect_error(plot(harbour_seals, + value = "nonsense")) + # Doesn't pass, even though figures do look the same + #expect_equal(plot(dplyr::filter(harbour_seals, + # region != "Coastwide")), + # plot(harbour_seals, + # include_coastwide = FALSE)) + +})