95

Roxygen的工作方式似乎是第一行是\title,其他所有内容都在 中\details,然后任何@foo指令处理这些事情。但是 R 文档比这更丰富。我可以"\section{Llamas}{Are they ungulates?}"在 .Rd 文件中。

但是我不能让 Roxygen 做任何事情,除了把它全部包装在 \details 中。我错过了什么吗?

我有一个 hacky 解决方案,即}在我的\section. 这将结束该\details部分。然后我必须不要结束},因为 roxygen 坚持认为它关闭了\details. 哎呀呀呀呀呀。

4

1 回答 1

25

已添加此支持(至少在 roxygen2 中)。您只需要添加@section Llamas:,然后在满足新指令之前的任何内容都将位于 Llamas 部分。这是一个例子

#' Llama llama llama
#' 
#' More about llamas
#' 
#' @section Llamas:
#' Are they ungulates?
#' 
#' @section Not llamas:
#' This section is not about llamas.  It is not very interesting.
#' 
#' @param notused A parameter that isn't used at all!
#' @export
llama <- function(notused){
    return("LLAMA LLAMA LLAMA")
}

它为 .Rd 文件提供了以下内容

\name{llama}
\alias{llama}
\title{Llama llama llama}
\usage{
  llama(notused)
}
\arguments{
  \item{notused}{A parameter that isn't used at all!}
}
\description{
  More about llamas
}
\section{Llamas}{
  Are they ungulates?
}

\section{Not llamas}{
  This section is not about llamas.  It is not very
  interesting.
}
于 2013-05-19T03:18:39.703 回答