在打包/插图构建期间出现“'knitr'not found”错误

时间:2014-10-14 18:08:25

标签: r knitr

我正在使用knitr构建一个R包晕影。这个过程在R 3.0之前有效,但是我无法在R 3.1.1下重建包。

当我尝试R CMD build时,收到错误消息:

R CMD build Causata
* checking for file ‘Causata/DESCRIPTION’ ... OK
* preparing ‘Causata’:
* checking DESCRIPTION meta-information ... OK
* installing the package to build vignettes
* creating vignettes ...

ERROR Error in loadVignetteBuilder(vigns$pkgdir) :
  vignette builder 'knitr' not found Calls: <Anonymous> -> loadVignetteBuilder
In addition:
  Warning message: In tools::buildVignettes(dir = ".", tangle = TRUE) :
  Files named as vignettes but with no recognized vignette engine:
   ‘vignettes/Causata-vignette.rnw’ (Is a VignetteBuilder field missing?)
Execution halted

我的插图文件有一个VignetteEngine电话 - 这是前三行:

% !Rnw weave = knitr 
%\VignetteEngine{knitr::knitr}
%\VignetteIndexEntry{Model training and export}

我的包描述文件包含VignetteBuilder字段:

VignetteBuilder: knitr

我想我正在遵循Rnw vignettes的说明,所以我对我看到的错误信息感到困惑。

顺便说一句,如果我尝试直接构建小插图,那么一切似乎都很完美。此命令生成小插图PDF:

tools::buildVignettes(dir=".", tangle=TRUE)

我的麻烦似乎只有R CMD build。为什么构建不起作用?

这是我的完整包装描述文件供参考:

Package: Causata
Type: Package
Title: Analysis utilities for binary classification and Causata users.  
Version: 5.0-1
Date: 2014-10-09
Author: Justin Hemann, David Barker, Suzanne Weller, Jason McFall
Maintainer: Justin Hemann <justin.hemann@nice.com>
Description: The Causata package provides utilities for 
    extracting data from the Causata application, training regression / classification 
    models, and exporting models as PMML for scoring.
Depends: R (>= 2.15.1)
Imports: XML, R.utils, rjson, RCurl, stringr, yaml, boot, foreach, data.table, glmnet, ggplot2, methods
Suggests: knitr, doMC, testthat, pROC, RODBC, RMySQL
VignetteBuilder: knitr
License: GPL
LazyLoad: yes
URL: www.nice.com

2 个答案:

答案 0 :(得分:8)

根据Josh O&Brien Brien的反馈,我猜你可能和他有同样的问题。如果您想添加一些自定义库路径,我建议您使用环境变量~/.RenvironR_LIBS_USER中执行此操作,而不是在~/.Rprofile或{中定义库路径{1}}。后者似乎被Rprofile.siteR CMD build忽略了。

答案 1 :(得分:0)

或者您可以将Sys.setenv(R_LIBS_USER="/my/r-package/dir/")添加到~/.Rprofile