5

由于某种原因pkgdown,无法解析我的包中的 .Rd 文件之一。roxygen2当我使用@examples标签或@example inst/example/add.R替代方法向文档添加示例时,我发现它失败了。我将我的函数最小化为两个参数,以使其更“可重复”并且仍然得到相同的错误。请在下面找到错误消息、使用该消息生成 devtools::document()的 .Rd 文件以及该函数的 roxygen2 文档。如您所见,我正在使用一个非常简单的示例,该示例应该可以毫无问题地运行...还要说的是,当我运行devtools::check()所有示例时,我都通过了,所以我不明白为什么pkgdown会失败。

非常感谢你的帮助。

最好的,

错误信息

Reading 'man/merge.Rd'
Error : Failed to parse Rd in merge.Rd
i unused argument (output_handler = evaluate::new_output_handler(value = pkgdown_print))
Error: callr subprocess failed: Failed to parse Rd in merge.Rd
i unused argument (output_handler = evaluate::new_output_handler(value = pkgdown_print))

.Rd 文件

% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/merge.R
\name{merge}
\alias{merge}
\title{Merge two tables}
\usage{
merge(x, y)
}
\arguments{
\item{x}{data frame: referred to \emph{left} in R terminology, or \emph{master} in
Stata terminology.}

\item{y}{data frame: referred to \emph{right} in R terminology, or \emph{using} in
Stata terminology.}
}
\value{
a data.table joining x and y.
}
\description{
This is the main and, basically, the only function in joyn.
}
\examples{
x <- c(1, 2)
}

roxygen2 文档

#' Merge two tables
#'
#' This is the main and, basically, the only function in joyn.
#'
#' @param x data frame: referred to *left* in R terminology, or *master* in
#'   Stata terminology.
#' @param y data frame: referred to *right* in R terminology, or *using* in
#'   Stata terminology.
#' @return a data.table joining x and y.
#' @export
#' @import data.table
#'
#' @examples
#' x <- c(1, 2)
4

1 回答 1

4

这个错误来自downlit::evaluate_and_highlight(遗憾的是它没有在输出中报告),并且可以通过安装开发版本来修复downlit

library(devtools)
install_github('r-lib/downlit')

仅当您也使用 git 版本时才有意义pkgdown,稳定pkgdown版(版本 1.6.1)与 stable 版运行得很好downlit。当然,任何包的开发版本都可能随时中断,但除非它没有,否则没关系。

于 2021-07-23T16:19:23.630 回答