'How to format DOI in Rmd vignette so that correct in Rd?
When I check my package on rhub with devtools::check_rhub(), I get notes that there are incorrectly formatted DOIs in the vignettes, e.g.
URL: doi:10.1029/2002GL016612 From: inst/doc/introduction-to-sedproxy.html Message: Invalid URI scheme (use \doi for DOIs in Rd markup)
I am generating the vignettes from rmarkdown (.Rmd) files. How do I format DOIs in Rmd so that they will be correct in Rd?
Solution 1:[1]
From section 2.1.1 Documenting functions in https://cran.r-project.org/doc/manuals/r-devel/R-exts.html :
A section with references to the literature. Use \url{} or \href{}{} for web pointers, and \doi{} for DOIs (this needs R >= 3.3, see User-defined macros for more info).
Thus, it's recommended to use this for your reference as well (even if it works directly without the \doi{} by prefixing it with the https://doi.org/):
\doi{10.1029/2002GL016612}
This should not prompt a NOTE from running R CMD check with --as-cran. This seems to be the case also for vignettes / R markdown and not just Rd files.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
