Does roxygen2 6.0.0 now require "@export" in the last line?
Asked Answered
D

1

24

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.

Donaldson answered 8/2, 2017 at 14:59 Comment(8)
Was your problem solved? I think I have the same issue although export is always last.Countershading
Not really. This was part of a larger versioning issue I was bug fixing. In the end I settled on package version control using tools like packrat and checkpoint. The root cause of this and another bug still elude me, but reverting back to prior packages 'fixed' them.Donaldson
If you are using RStudio: In my case the root cause was a missing check in Tools => Project options => Build Tools: Generate documentation.Countershading
Christoph, that wasn't mine, but is still a good point.Donaldson
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)Rockweed
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)Rockweed
I typically use the rstudio keyboard shortcuts, which I believe call roxygenize()Donaldson
Have you tried deleting the NAMESPACE file and then re-roxygenizing?Atmospheric
W
2

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:

Woodrum answered 8/2, 2017 at 14:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.