1

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".

Empiromancer
  • 3,778
  • 1
  • 22
  • 53
  • Are you greatly opposed to adding `@export` to the roxygen for bar? That's what the @export in your code for foo does for you. It's the same way with an aliased function. – Dason Sep 09 '16 at 16:55
  • I tried that, as it seemed the natural thing to do, but it still didn't get exported. I concluded there was some syntactical nuance I was missing. – Empiromancer Sep 09 '16 at 16:58
  • Did you rerun roxygen? – Dason Sep 09 '16 at 17:01
  • With `devtools::document()`. That should do it, right? – Empiromancer Sep 09 '16 at 17:03
  • 1
    It should. If you check your NAMESPACE file has it been modified to include bar? I'm just wondering if you updated your package but forgot to build/install it and tried using the one that is installed locally to test if it worked. – Dason Sep 09 '16 at 17:03
  • After some trial and error I happened upon the problem - `@rdname` doesn't like the description text. The mishaps you posit in your last comment might be why it didn't work before I switched from `@describeIn` to `@rdname` though, so thanks! – Empiromancer Sep 09 '16 at 17:18

1 Answers1

1

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
Empiromancer
  • 3,778
  • 1
  • 22
  • 53