尽管没有错误,小插图输出仍然丢失

时间:2019-05-23 09:27:28

标签: r devtools

我正在用这个小插图标题写an R package

---
title: "Adaptive non-parametric learning"
author: "..."
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Adaptive non-parametric learning}
  %\VignetteEngine{knitr::rmarkdown_notangle}
  %\VignetteEncoding{UTF-8}
---

我添加了rmarkdown_notangle以避免在CRAN上运行该小插图,因为完整的小插图要花一个小时才能运行(即使现在我正在测试,也需要2分钟)。

我使用以下命令编译软件包:

Rscript -e "devtools::document();devtools::check();devtools::build();devtools::install();"

输出显示:

...
─  installing the package to build vignettes
✔  creating vignettes (1m 48.8s)
...
✔  checking files in ‘vignettes’ ...
...
✔  checking for unstated dependencies in vignettes ...
✔  checking package vignettes in ‘inst/doc’
✔  checking re-building of vignette outputs (1m 47.9s)
...
─  installing the package to build vignettes
✔  creating vignettes (1m 49.5s)
...
** installing vignettes
** testing if installed package can be loaded
* DONE (PosteriorBootstrap)
Reloading attached PosteriorBootstrap

但是doc/目录为空,inst/doc目录不存在,并且当我导入软件包时,没有安装任何小插图:

> library(PosteriorBootstrap)
> browseVignettes(package="PosteriorBootstrap")
No vignettes found by browseVignettes(package = "PosteriorBootstrap")
> vignette("Adaptive Non-parametric learning")
Warning message:
vignette ‘Adaptive Non-parametric learning’ not found

我发现this thread建议使用我使用的%\VignetteEngine{knitr::rmarkdown}install_github(..., build_vignettes=TRUE),因为我是在本地构建的,所以我不使用它。

小插图的输出在哪里?

1 个答案:

答案 0 :(得分:0)

一种解决方案是更改TextView中的默认build_vignettes = FALSE

devtools::install()

然后执行devtools::install(build_vignettes = TRUE) 以显示小插图,例如在浏览器上,如果您在命令行上使用R。

我从a comment in the thread I quoted找到了解决方案,它为browseVignettes(package = "package_name")提出了相同的解决方案。

我找不到devtools::install_github()devtools::check()创建的小插图输出。

相关问题