Consider this dummy R6Class
:
#' @title MyClass
#' @description A dummy class example
MyClass <- R6::R6Class(
"MyClass",
public = list(
#' @field x Data frame or tibble
x = NULL,
#' @description Create a `MyClass` object.
#' @param x A data frame or tibble that contains at least a column "a" and "b".
initialize = function(x) {
self$x <- x
},
#' @description Paste data to column "a".
#' @param col Variable used to paste data.
#' @returns A tibble.
paste_to_a = function(col) {
private$paste("a", col)
},
#' @description Paste data to column "b".
#' @param col Variable used to paste data.
#' @returns A tibble.
paste_to_b = function(col) {
private$paste("b", col)
}
),
private = list(
paste = function(x, y) {
dplyr::mutate(self$x, !!x := paste(.data[[x]], .data[[y]], sep = "_"))
}
)
)
Is there a way to reuse the documentation across paste_to_a
and paste_to_b
?
I've tried #' @describeIn paste_to_a
or #' @inheritParams paste_to_a
in paste_to_b
but it makes devtools::document()
unhappy.
1: [myclass.R:25] @describeIn requires name and description
2: [myclass.R:4] Undocumented R6 method: paste_to_b
3: [myclass.R:4] Must use one @param for each argument
✖ $paste_to_b(col) is not documented
or
1: [myclass.R:4] Undocumented R6 method: paste_to_b
2: [myclass.R:4] Must use one @param for each argument
✖ $paste_to_b(col) is not documented
3: @inheritParams failed in topic "MyClass".
✖ All parameters are already documented; none remain to be inherited.