r-lib / pkgdown

Generate static html documentation for an R package

Home Page:https://pkgdown.r-lib.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Auto-link S4 methods

albertocasagrande opened this issue · comments

While standalone functions support auto-linking as reported in the documentation, S4 methods do not. For instance, pkgdown writes Foo$bar() in code mode when Foo$bar() is surrounded by backticks, but it does not add the proper link.

Is there any "standard" way to link S4 methods?

That doesn't look like an S4 method call, it looks like R6 or S7. One way to link to them is to link to the help page directly, by putting a help call in the text, e.g. help("coef,mle-method", package="stats4") should link to the help for the coef method for mle objects in the stats4 package. If you are using R6 or S7, the syntax for the aliases would be different, but the principle would be the same.

I don't know if there's an easy way to link to a topic but show different text, e.g. using the above link, but showing coef(mle_object).

Thank you for the answer.