roxygen2
roxygen2 copied to clipboard
Inheriting multiple parameters when one of them is missing
When importing some parameter documentation from a shared entry if there is one missing the documentation is not added (and user is not warned!)
See the following example with gtsummary::tbl_summary that has missing, missing_text, missing_stat documented together and only if the three arguments are present the documentation is inherited (foo()). On the second case (bar()) the user is left without knowing (until they run R CMD check or devtools::check_man())
library(roxygen2)
roc_proc_text(rd_roclet(),
"
#' dummy
#'
#' @inheritParams gtsummary::tbl_summary
foo <- function(missing, missing_text, missing_stat){
}
#' dummy
#'
#' @inheritParams gtsummary::tbl_summary
bar <- function(missing_text, missing_stat){
}
")
#> $foo.Rd
#> % Generated by roxygen2: do not edit by hand
#> % Please edit documentation in ./<text>
#> \name{foo}
#> \alias{foo}
#> \title{dummy}
#> \usage{
#> foo(missing, missing_text, missing_stat)
#> }
#> \arguments{
#> \item{missing, missing_text, missing_stat}{Arguments dictating how and if missing values are presented:
#> \itemize{
#> \item \code{missing}: must be one of \code{c("ifany", "no", "always")}.
#> \item \code{missing_text}: string indicating text shown on missing row. Default is \code{"Unknown"}.
#> \item \code{missing_stat}: statistic to show on missing row. Default is \code{"{N_miss}"}.
#> Possible values are \code{N_miss}, \code{N_obs}, \code{N_nonmiss}, \code{p_miss}, \code{p_nonmiss}.
#> }}
#> }
#> \description{
#> dummy
#> }
#>
#> $bar.Rd
#> % Generated by roxygen2: do not edit by hand
#> % Please edit documentation in ./<text>
#> \name{bar}
#> \alias{bar}
#> \title{dummy}
#> \usage{
#> bar(missing_text, missing_stat)
#> }
#> \description{
#> dummy
#> }
Created on 2025-12-11 with reprex v2.1.1
Could inheritParams inherit even if some parameter is missing (maybe with a warning) or at least warn if some parameters are not fully matched.