mat*_*sho 8 r roxygen2 r-package
我无法在R包帮助中显示编号列表.
这是我在roxygen中所拥有的:
#' @return
#' Bunch of text
#' Bunch of text:
#' \enumerate {
#' \item a
#' \item b
#' \item c
#' }
Run Code Online (Sandbox Code Playgroud)
这显示没有数字.保存文件后,单击Build & Reload in RStudio,然后运行devtools::document,然后devtools::load_all.当我在包上运行帮助时,我在控制台中收到以下消息:
Using development documentation for function name
Run Code Online (Sandbox Code Playgroud)
R Y*_*oda 11
一个简单的空间导致丢失的数字:只需删除后面enumerate和第一个空格{.
第二个问题是缺少标题文档(导致文档构建失败,但我想这不是你的问题,因为你认识到缺少的数字,所以构建必须成功).
这将有效:
#' My title...
#' @return
#' Bunch of text
#' Bunch of text:
#' \enumerate{
#' \item a
#' \item{b}
#' \item{c}
#' }
hello1 <- function() {
print("Hello, world!")
}
Run Code Online (Sandbox Code Playgroud)
?hello1 然后显示:
PS:您可以在构建日志中识别RStudio中的这种问题:
警告:hello1.Rd:12:意外的文字'',期待'{'
编辑1:
生成的Rd文件的名称和此文件中的行号在冒号后面的警告中指示(此处:12).
您可以man在包的文件夹中找到生成的Rd文件.
只需打开它并查找行号来检查问题:
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/hello1.R
\name{hello1}
\alias{hello1}
\title{My title...}
\usage{
hello1()
}
\value{
Bunch of text
Bunch of text:
\enumerate { % <- this is line number 12 !!!!
\item a
\item{b}
\item{c}
}
}
\description{
My title...
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
280 次 |
| 最近记录: |