Empiromancer
Empiromancer

Reputation: 3854

Use roxygen2 to export a variant function

When I use @describeIn or @rdname to document a variant of a function, the variant doesn't get exported. Is there a tag I can place in the roxygen skeleton to change this, or do I need to go directly into the NAMESPACE?

#' Title
#'
#' @return
#' @export
#'
#' @examples
foo <- function() {
  "foo"
}

#' @rdname foo A variant
#'
#' @export
bar <- function() foo()

When I attach this package, I can call foo just fine, but trying to call bar results in Error: could not find function "bar".

Upvotes: 1

Views: 352

Answers (1)

Empiromancer
Empiromancer

Reputation: 3854

The problem is the line of text after @rdname foo. Note the message about "invalid path" given when running roxygen:

> devtools::document()
Updating mypackage documentation
Loading mypackage
Writing NAMESPACE
Writing foo.Rd
Skipping invalid path:  foo A variant..Rd 

This can be fixed by removing that label text:

#' @rdname foo
#' @export

Or by using @describeIn:

#' @describeIn foo A variant.
#' @export

Upvotes: 1

Related Questions