library(alttip)Getting started with alttip
This vignette showcases altdoc styled with altdown’s pkgdown theme, with function hover previews and links from reftip.
A plain call
Note
An S3 method, called by name
animal() and speak.animal() share one Rd page and one \usage{} block. reftip narrows the tooltip to just this method, not the whole block.
rex <- animal("Rex", "woof")
speak.animal(rex)Rex says woof!
TipTip
print.animal() works the same way; try hovering it.
print.animal(rex)<animal: Rex>
Known limitations
WarningGeneric dispatch
print() is a generic; which method runs depends on rex’s class at runtime. reftip doesn’t run code, so it doesn’t know which method it belongs to. Hence no preview is given.
print(rex)<animal: Rex>
WarningR6 methods
Same story for $: nothing in counter$increment() says which class’s methods to look up, so it stays untouched too.
counter <- Counter$new()
counter$increment()
counter$increment(by = 2)
counter$value()[1] 3
Important
This package is a toy, built only to demonstrate altdown and reftip together. Don’t expect real functionality here.