Skip to content

Commit

Permalink
Fix documentation
Browse files Browse the repository at this point in the history
Addressing package check warnings for "Rd files with duplicated alias" and "Undocumented arguments in Rd file":

- remove duplicate aliases for EcologicalDroughtMetrics2023_annual/Clim and RR2022predictors_annual/Clim
- link to general "metrics" documentation for EcologicalDroughtMetrics2023_annual/Clim and RR2022predictors_annual/Clim
- use links to individual metrics in general "metrics" documentation
  • Loading branch information
dschlaep committed Dec 1, 2023
1 parent d3369c6 commit b0f7f8b
Show file tree
Hide file tree
Showing 7 changed files with 303 additions and 130 deletions.
24 changes: 16 additions & 8 deletions R/Functions_Metrics_002_newRR.R
Original file line number Diff line number Diff line change
Expand Up @@ -2178,14 +2178,16 @@ get_RR2022predictors_annual <- function(
#' means, standard deviations, or coefficients of variation of
#' annual values.
#'
#' @inheritParams metrics
#'
#' @references Chambers et al. (2023)
#' New indicators of ecological resilience and invasion resistance to support
#' prioritization and management in the sagebrush biome, United States.
#' Frontiers in Ecology and Evolution, 10, 1–17.
#' \url{https://doi.org/10.3389/fevo.2022.1009268}
#'
#' @seealso [RR2022predictors_annualClim()] and
#' [metric_RR2022predictors_annual()]
#' @seealso [RR2022predictors_annualClim()];
#' see [metrics] for a complete list of available metric functions.
#'
#' @name RR2022predictors_annual
#' @md
Expand Down Expand Up @@ -2226,6 +2228,8 @@ metric_RR2022predictors_annual <- function(
#' means, standard deviations, or coefficients of variation of
#' annual values (see `metric_RR2022predictors_annual()`).
#'
#' @inheritParams metrics
#'
#' @return A return object where `group` contains the following annual
#' variables:
#' * `"Tmean_mean"`
Expand Down Expand Up @@ -2259,8 +2263,8 @@ metric_RR2022predictors_annual <- function(
#' Frontiers in Ecology and Evolution, 10, 1–17.
#' \url{https://doi.org/10.3389/fevo.2022.1009268}
#'
#' @seealso [RR2022predictors_annual()] and
#' [metric_RR2022predictors_annualClim()]
#' @seealso [RR2022predictors_annual()];
#' see [metrics] for a complete list of available metric functions.
#'
#' @name RR2022predictors_annualClim
#' @md
Expand Down Expand Up @@ -2796,13 +2800,15 @@ get_EcologicalDroughtMetrics2023_annual <- function(

#' Annual time series of ecological drought metrics
#'
#' @inheritParams metrics
#'
#' @references Chenoweth et al. (2023)
#' Ecologically relevant moisture and temperature metrics for assessing
#' dryland ecosystem dynamics.
#' Ecohydrology, 16(3), e2509. \url{https://doi.org/10.1002/eco.2509}
#'
#' @seealso [EcologicalDroughtMetrics2023_annualClim()] and
#' [metric_EcologicalDroughtMetrics2023_annual()]
#' @seealso [EcologicalDroughtMetrics2023_annualClim()];
#' see [metrics] for a complete list of available metric functions.
#'
#' @section Details:
#' The following functions produce all metrics used by Chenoweth et al.:
Expand Down Expand Up @@ -2926,8 +2932,10 @@ metric_EcologicalDroughtMetrics2023_annual <- function(
#' annual values of metrics used by Chenoweth et al.
#' (see `metric_EcologicalDroughtMetrics2023_annual()`).
#'
#' @seealso [EcologicalDroughtMetrics2023_annual()] and
#' [metric_EcologicalDroughtMetrics2023_annualClim()]
#' @inheritParams metrics
#'
#' @seealso [EcologicalDroughtMetrics2023_annual()];
#' see [metrics] for a complete list of available metric functions.
#'
#' @return A return object where `group` contains the following climatologies of
#' annual variables summarized across years by means `mean`,
Expand Down
29 changes: 21 additions & 8 deletions R/rSW2metrics-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,34 +62,46 @@ rSW2_glovars <- new.env()
#' @exportPattern "^metric_[^\\.]"


rd_alias_metrics <- function() {
md_aliases_of_metrics <- function() {
tmp <- list_all_metrics()

# Remove `metric_SW2toTable_daily()` because it has it's own documentation
exclude_metrics <- "metric_SW2toTable_daily"
# Remove metrics that have their own dedicated documentation
exclude_metrics <- c(
"metric_SW2toTable_daily",
"EcologicalDroughtMetrics2023_annual",
"EcologicalDroughtMetrics2023_annualClim",
"RR2022predictors_annual",
"RR2022predictors_annualClim"
)

ids_remove <- unique(unlist(lapply(
exclude_metrics,
FUN = grep,
x = basename(tmp)
)))
tmp <- tmp[-ids_remove]

if (length(ids_remove) > 0L) {
tmp <- tmp[-ids_remove]
}

paste("@aliases", paste(tmp, collapse = " "))
}

rd_section_listing_metrics <- function() {
rd_section_list_metrics <- function() {
paste(
"\\section{List of currently available metrics:}{\n",
"\\itemize{\n",
paste(
" \\item", # nolint: nonportable_path_linter.
paste0("\\var{", list_all_metrics(), "}"),
paste0("\\code{\\link{", list_all_metrics(), "}}"),
collapse = "\n"
),
"\n}}"
)
}



#' End-user functions that calculate a specific `metric`
#'
#' These functions have a name that starts with `metric_`.
Expand Down Expand Up @@ -171,9 +183,10 @@ rd_section_listing_metrics <- function() {
#' a different type of output, i.e., spreadsheets of the most important
#' daily `SOILWAT2` variables, see [`SW2toTable`].
#'
#' @evalRd rd_section_listing_metrics()
#' @evalRd rd_section_list_metrics()
#'
#' @eval md_aliases_of_metrics()
#'
#' @eval rd_alias_metrics()
#' @name metrics
NULL

Expand Down
43 changes: 41 additions & 2 deletions man/EcologicalDroughtMetrics2023_annual.Rd

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

43 changes: 41 additions & 2 deletions man/EcologicalDroughtMetrics2023_annualClim.Rd

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

43 changes: 41 additions & 2 deletions man/RR2022predictors_annual.Rd

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

43 changes: 41 additions & 2 deletions man/RR2022predictors_annualClim.Rd

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

Loading

0 comments on commit b0f7f8b

Please # to comment.