当我在R中编写函数文档并引用外部包时,我使用code{link[package]{function}}
,这对于交互式R中的?
函数非常有效。
但是我的pdf文件有"function"的链接文本,链接只是到我的目录。我如何关闭这些pdf链接?
您可以利用Rd格式的条件文本宏。在编写R扩展中给出的例子是HTML与LaTeX格式的一个非常简单的演示:
if{latex}{out{alpha}}ifelse{html}{out{α}}{alpha}
条件可以用if-then (if{format}{alternate}
)或if-then-else (ifelse{format}{text}{alternate}
)结构表示。所以,对于你的例子,你可以这样做:
if{html}{code{link[package]{function}}}
或:
ifelse{html}{code{link[package]{function}}}{code{function}}
注意:您也可以将多种格式表示为逗号分隔的列表,如ifelse{latex,html}{...}{...}
。