1

I am writing a package with an R6 class and several methods.

When I use the @examples tag to conotatea method, the examples test is displayed twice in the output.

#' R6 Class Representing a Person
#'
#' @description
#' A person has a name and a hair color.
#'
#' @details
#' A person can also greet you.

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
                        #' Change hair color.
                        #' @param val New hair color.
                        #' @examples
                        #' P <- Person("Ann", "black")
                        #' P$hair
                        #' P$set_hair("red")
                        #' P$hair
                        set_hair = function(val) {
                          self$hair <- val
                        }
                      ), cloneable = FALSE
)

How can I prevent the examples from being displayed for the second time?

0 Answers0