在R包中显示编号列表
Displaying numbered list in R package
我无法在 R 包帮助中显示编号列表。
这是我在 roxygen 中所拥有的:
#' @return
#' Bunch of text
#' Bunch of text:
#' \enumerate {
#' \item a
#' \item b
#' \item c
#' }
这是没有数字的显示。保存文件后,我单击 Build & Reload in RStudio
,然后单击 运行 devtools::document
,然后单击 devtools::load_all
。当我 运行 对包提供帮助时,我在控制台中收到以下消息:
Using development documentation for function name
一个简单的 space 导致缺少数字:只需删除 enumerate
之后的 space 和第一个 {
.
第二个问题是缺少标题文档(这会导致文档构建失败,但我想这不是你的问题,因为你识别出了缺失的数字,所以构建必须有成功了)。
这会起作用:
#' My title...
#' @return
#' Bunch of text
#' Bunch of text:
#' \enumerate{
#' \item a
#' \item{b}
#' \item{c}
#' }
hello1 <- function() {
print("Hello, world!")
}
?hello1
则显示:
PS:您可以在构建日志中识别 RStudio 中的此类问题:
Warning: hello1.Rd:12: unexpected TEXT ' ', expecting '{'
编辑 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...
}
我无法在 R 包帮助中显示编号列表。
这是我在 roxygen 中所拥有的:
#' @return
#' Bunch of text
#' Bunch of text:
#' \enumerate {
#' \item a
#' \item b
#' \item c
#' }
这是没有数字的显示。保存文件后,我单击 Build & Reload in RStudio
,然后单击 运行 devtools::document
,然后单击 devtools::load_all
。当我 运行 对包提供帮助时,我在控制台中收到以下消息:
Using development documentation for function name
一个简单的 space 导致缺少数字:只需删除 enumerate
之后的 space 和第一个 {
.
第二个问题是缺少标题文档(这会导致文档构建失败,但我想这不是你的问题,因为你识别出了缺失的数字,所以构建必须有成功了)。
这会起作用:
#' My title...
#' @return
#' Bunch of text
#' Bunch of text:
#' \enumerate{
#' \item a
#' \item{b}
#' \item{c}
#' }
hello1 <- function() {
print("Hello, world!")
}
?hello1
则显示:
PS:您可以在构建日志中识别 RStudio 中的此类问题:
Warning: hello1.Rd:12: unexpected TEXT ' ', expecting '{'
编辑 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...
}