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

allow multiple @inheritDotParams #767

maxheld83 opened this issue Jul 31, 2018 · 3 comments

allow multiple @inheritDotParams #767

maxheld83 opened this issue Jul 31, 2018 · 3 comments
feature a feature request or enhancement inherit 👨‍👩‍👧‍👦


Copy link

thanks so much for #' @inheritDotParams; it's a fantastic addition.

Though I couldn't find documentation for this, it appears that you can currently use only one #' @inheritDotParams per documentation entry.

When, all other things equal, I try to add two such tags for the same function, I get this error message:

Error in mapply(FUN = f, ..., SIMPLIFY = FALSE) : 
  zero-length inputs cannot be mixed with those of non-zero length
Calls: suppressPackageStartupMessages ... topics_process_inherit -> <Anonymous> -> fun -> Map -> mapply

Is this a known/intended limitation of #' @inheritDotParams?

My use case is something like this:

#' Do something
#' Does something
#' @param x [`character(1)`] very interesting text.
#' @inheritDotParams lower_level_fun_a -x
#' @inheritDotParams lower_level_fun_b -x
higher_level_fun(x, ...) {
  lower_level_fun_a(x, ...)
  lower_level_fun_b(x, ...)
#' Do a
#' Does a
#' @param foo a very fooish character
lower_level_fun_a(x, foo = "zap") {
  print(x, foo)
#' Do b
#' Does b
#' @param bar a very booish character
lower_level_fun_b(x, bar = "zong") {
  print(x, zong)

I understand that passing on ... to multiple functions is a bit risky, because if arguments carry the same names, they get matched twice (intended here).

But if this seems safe to the dev, multiple #' @inheritDotParams could save a lot of typing.

Copy link

@maxheld83 I've also encountered this issue after multiple attempts to generate Rd files from roxygen. Allowing for multiple inheritDotParams would definitely save on typing time.

Copy link

@halldc, given that you have that nice pull request #842 for improving inheritDocParams, perhaps you have an idea how to fix this issue?

Copy link

This error was due to a simple cut-and-paste error in a single line in the code. I have submitted pull request #854 which fixes it.

@hadley hadley added feature a feature request or enhancement inherit 👨‍👩‍👧‍👦 labels Jul 20, 2019
@hadley hadley added this to the v6.2.0 milestone Aug 22, 2019
@hadley hadley closed this as completed in 9bd9f4a Sep 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
feature a feature request or enhancement inherit 👨‍👩‍👧‍👦
None yet

No branches or pull requests

4 participants