r - 尽管没有错误,但缺少晕影输出
问题描述
我正在用这个小插图标题写一个 R 包:
---
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
我发现这个线程建议使用%\VignetteEngine{knitr::rmarkdown}
,我使用和install_github(..., build_vignettes=TRUE)
,因为我在本地构建它,所以我不使用它。
小插曲输出在哪里?
解决方案
One solution is to change the default build_vignettes = FALSE
in devtools::install()
:
devtools::install(build_vignettes = TRUE)
Then do browseVignettes(package = "package_name")
to show the vignettes, e.g. on a browser if you use R on the command line.
I found the solution from a comment in the thread I quoted, which suggested the same solution for devtools::install_github()
.
I could not find the vignette output created by devtools::check()
and devtools::build()
.
推荐阅读
- macos - 在 emacs/iTerm2 中更改鼠标滚动动作
- c - 递归和非递归得到不同的答案
- python - 使用另一个类 Python 从一个类打印对象
- javascript - 使用模块化 JS 正确处理 Promise,我可以多次引用同一个 Promise.then() 吗?
- android - 运行单元测试用例时无法在动态功能模块中引用应用模块类
- google-chrome-extension - 如何更新使用 chrome.tabs.create({ url }) 打开的选项卡
- html - 自动填充不适用于非用户名和密码
- makefile - 复制与makefile中的模式匹配的文件
- python - 如何使用 Pandas 从化学式中提取氢的数量(即从 C18H36P1 得到 36)
- excel - 如何根据最接近的值匹配两个数组 +/-