I am wondering it there exists a method to link
to function from other package when I'm trying to write a documentation for new package using roxygen2
. Something like \link{pck=PACKAGE_NAME, fun=FUNCTION_NAME}
?
To add documentation to an R package, you need to create a subdirectory “ man ” containing a set of files, one per function, in a special R Documentation format ( . Rd ). These will be the source for the documentation for each function; R processes them to create plain text, PDF, and HTML versions.
But you can add an ROxygen2 skeleton for a function by placing your cursor inside the function then pressing ctr+alt+shift+R . Then if you hit enter in the ROxygen2 codeblock it will automatically add the backtick.
R packages contain code, data, and documentation in a standardised collection format that can be installed by users of R, typically via a centralised software repository such as CRAN (the Comprehensive R Archive Network).
You have to type \link[pkg]{function}
e.g. \link[stringi]{stri_c}
Roxygen2
now also supports documentation written in markdown.
The markdown syntax is for the link is [foo::bar()]
which is translated to \code{\link[foo:bar]{foo::bar()}}
in the generated .Rd file. (See Roxygen2 vignette.)
Note that you may need to specifically turn on Markdown support by writing Roxygen: list(markdown = TRUE)
in your DESCRIPTION
file, or by putting an #' @md
comment if you want to enable markdown only for a specific man page. This is also explained at the very top of the linked vignette. (Thanks to @Tjebo for the comment)
Note that there are two colons in the markdown version whereas there is only one colon in the Rd version.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With