[Rd] roxygen2 / documentation of reexports
Blätte, Andreas
@ndre@@@b|@ette @end|ng |rom un|-due@de
Sat Jun 27 13:06:04 CEST 2020
Dear colleagues,
preparing a release of my package ‚polmineR’ I encountered the following issue with a new warning issued when running R CMD check with the --as-cran option on Debian with R-devel.
To reexport the magrittr pipe operator %>%, my package adopted I snippet you’d see in the dplyr package, for instance:
#' @importFrom magrittr %>%
#' @export
magrittr::`%>%`
The dplyr package has many statements of this kind and I guess the pattern is common. Roxygn2 will prepare a file documenting the reexport. But the Rd file prepared by Roxygen2 will result in an error saying “Non-file package-anchored link(s) in documentation object”.
The part of the Rd file that is not in line with CRAN requirements is: \code{\link[magrittr]{\%>\%}}
Looking around for a solution, I realized that the DT package was adopted recently to address the issue (commit message “fix the R-devel issue about documentation links“):
https://github.com/rstudio/DT/commit/99daef8fcd376c285f3a82be753b80dee7ae3670
The snippet to do the reexport is somewhat different (I report magrittr pipe only):
#' @importFrom magrittr %>%
#' @export %>%
NULL
But on this basis, roxygen2 will not prepare the Rd file for the reexports automatically. As I understand it, an Rd file for the DT package that works and meets the requirements of R-devel has been written manually (https://github.com/rstudio/DT/blob/master/man/DT-imports.Rd). So this is what I did for my polmineR package because I need to get it published asap (it has been archived). It works and it passes tests. So far so good.
I like to use roxygen2 systematically and I dislike having to write the reexports single file manually. So does anybody know another solution?
Checking / testing dplyr (master branch) on my Debian R-devel test environment, I realize that dplyr has many reexports that are documented in a manner that evokes the same issues I have seen. I assume that further packages will encounter this issue.
Kind regards
Andreas (Blätte)
--
Prof. Dr. Andreas Blätte
Professor of Public Policy and Regional Politics
University of Duisburg-Essen
[[alternative HTML version deleted]]
More information about the R-devel
mailing list