24
votes

Prior to updating to roxygen2 version 6.0.0, it appeared that the package supported using the @export tag not at the bottom of the function header in a package. For instance:

#' Title
#' @param foo
#' @return bar
#'
#' @export
#'
#' @seealso Other blah blah

The code above would build successfully with roxygen2 properly filling out the namespace when using my installation of roxygen2 version 5.0.1. However, with the update this form of documentation would not work and roxygen2 actively removes it from the NAMESPACE.R.

I could fix this by moving @export to the bottom

#' Title
#' @param foo
#' @return bar
#'
#' @seealso Other blah blah
#' @export

My question is whether this issue occurs by design? I can't see anything specifying this change to @export in the release notes: https://github.com/klutometis/roxygen/releases/tag/v6.0.0

Was this always how roxygen2 was supposed to work and the operation up until this point was unintended? Or is this a deliberate change?

N.B. Obviously making a full mwe for different versions is difficult, any suggestions on how to tackle this welcome

EDIT: After further testing I'm beginning to suspect that there is more to this than just roxygen. I am using the build and document shortcuts in rstudio, which I also update recently, and even stepping back to roxygen2 version 5.0.1 stops me rebuilding the documentation of the old functions that used to work.

1
Was your problem solved? I think I have the same issue although export is always last.Christoph
If you are using RStudio: In my case the root cause was a missing check in Tools => Project options => Build Tools: Generate documentation.Christoph
I don't have this issue. I can put @export anywhere and have the function show up in the NAMESPACE file. (and yes I'm on version 6.0.0)Dason
So I guess part of the question is what command are you using to generate your documentation? I typically use document from devtools but using roxygenize() from roxygen2 directly gives me the same result (mainly that even if export isn't at the bottom it still includes it in the NAMESPACE file)Dason
Have you tried deleting the NAMESPACE file and then re-roxygenizing?petermeissner

1 Answers

2
votes

In the backlog of the Roxygen2 package there were couple of bugs related to @export in 2017.

They are fixed now and cannot be reproduced: