How to inherit roxygen documentation from an R6 method? The following code (slightly changed Roxygen R6 documentation example)
#' R6 Class representing a person
#'
#' A person has a name and a hair color.
Person <- R6::R6Class("Person",
public = list(
#' @field name First or full name of the person.
name = NULL,
#' @field hair Hair color of the person.
hair = NULL,
#' @description
#' Create a new person object.
#' @param name Name.
#' @param hair Hair color.
#' @return A new `Person` object.
initialize = function(name = NA, hair = NA) {
self$name <- name
self$hair <- hair
self$greet()
},
#' @description
#' Change hair color.
#' @inheritParams Person$initialize
#' @examples
#' P <- Person("Ann", "black")
#' P$hair
#' P$set_hair("red")
#' P$hair
set_hair = function(hair) {
self$hair <- hair
}
)
)
returns warnigs
Warning: argument `hair` undocumented for R6 method `set_hair()`
Warning message:
Topic 'Person': no parameters to inherit with @inheritParams
I have tried some different ways how to refer to R6 methods but any of them is working. Is it even possible?