Related: #931
It is fairly common in my (admittedly limited) experience to have something like:
# In R6.R
#' @param x An object
#' @export
R6Class("MyClass",
public = list(
x = NULL
my_method = \(x) {
self$x <- my_method_impl(x)
self
}
)
)
# my_method.R
#' @inheritParams MyClass$my_method
#' @noRd
my_method_impl <- function(x) x
The point is my_method_impl and MyClass$my_method share parameters, but are documented in separate source files. I believe (untested) that @inheritParams MyClass will work today, but this only helps with the user-facing documentation -- my suggestion is for helping other developers reading the code.
In this simple case, it's easy to guess where to look for a description of x, but may be harder for complicated classes with many methods.
So in my mind, @inheritParams MyClass$my_method is pure syntax -- the roxygenize() backend simply removes $my_method and proceeds the same as @inheritParams MyClass.
As a workaround, I find myself using non-roxygen comments:
#' @inheritParams MyClass
#.' <specifically, the my_method method>
#' @noRd
my_method_impl <- function(x) x
Related: #931
It is fairly common in my (admittedly limited) experience to have something like:
The point is
my_method_implandMyClass$my_methodshare parameters, but are documented in separate source files. I believe (untested) that@inheritParams MyClasswill work today, but this only helps with the user-facing documentation -- my suggestion is for helping other developers reading the code.In this simple case, it's easy to guess where to look for a description of
x, but may be harder for complicated classes with many methods.So in my mind,
@inheritParams MyClass$my_methodis pure syntax -- theroxygenize()backend simply removes$my_methodand proceeds the same as@inheritParams MyClass.As a workaround, I find myself using non-roxygen comments: