سؤال

Consider a base package XYZ, written by someone else, which has a function ABC, I want to extend the functionality of ABC in my new (NOT XYZ) package via the following method.

ABC <- function(...){
  ##INSERT EXTRA WORK.

  ##CALL THE BASE METHOD
  XYZ::ABC(...)
}

Now I want to document my new function ABC (via Roxygen), creating a link to the parent function for reference purposes.

\code{\link{XYZ::ABC}} does not work, no function cannot be found.

\link{ABC} creates a link to a list of possible candiate Rd files,

How do I create the hyperlink DIRECTLY to the BASE function.

هل كانت مفيدة؟

المحلول

\code{\link[XYZ]{ABC}}

This is briefly documented in the Cross-references section of Writing R Extensions:

There are two other forms of optional argument specified as \link[pkg]{foo} and \link[pkg:bar]{foo} to link to the package pkg, to files foo.html and bar.html respectively.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top