My reprex package jranke:R6ExampleTest fails like this:
LANG=C Rscript -e 'roxygen2::roxygenize()'
Loading R6ExampleTest
Loading required package: R6
Error in file.path(base_path, x$val) :
cannot coerce type 'closure' to vector of type 'character'
Calls: <Anonymous> ... roxy_tag_rd -> roxy_tag_rd.roxy_tag_example -> file.path
Execution halted
I believe the cause of this bug is the same as for #1151, the character string base_path is not found, only the function base_path() as defined in https://github.com/r-lib/roxygen2/blob/master/R/collate.R#L71
I had a similar issue which seemed to be circumvented by separating the @example into its own roxygen block:
#' My Class.
#'
#' @name MyClass
#' @example path/to/example.R
NULL
#' @rdname MyClass
#' @export
MyClass <- R6::R6Class(...)
Thanks for the workaround.
Most helpful comment
I had a similar issue which seemed to be circumvented by separating the
@exampleinto its own roxygen block: