18

So, I'd like to reference one of my package vignettes inside the roxygen2 comments of a function but I'm having a hard time understanding how to do it.

More generally, how do we reference documents inside /inst/doc? E.g. I'd like to reference /inst/doc/mypdf.pdf inside the roxygen2 comments for myFunc. What would that look like? Is it even possible?

StevieP
  • 1,569
  • 12
  • 23

2 Answers2

15

I just tell people to run the code that opens the vignette:

#' For more details see the help vignette:
#' \code{vignette("help", package = "mypkg")}
hadley
  • 102,019
  • 32
  • 183
  • 245
12

I know this is 4 years old...and hadley provided the answer...but I'd like to offer another option:

\href{../doc/help.html}{\code{vignette("help", package = "mypkg")}}

This gives a direct link to opening the vignette, and provides the code to show the user how to open it on their own.

ldecicco
  • 883
  • 8
  • 16
  • 1
    I'd take back this recommendation if you are using pkgdown. pkgdown will turn the `\code{vignette("help", package = "mypkg")}` directly to a url to the vignette article (ie..using what was recommended above) – ldecicco Oct 16 '20 at 04:23