简体   繁体   中英

“'knitr' not found” error during package / vignette build

I'm using knitr to build an R package vignette. This process worked before R 3.0, but I haven't been able to rebuild the package under R 3.1.1.

When I try R CMD build I get an error message:

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

My vignette file has a VignetteEngine call -- here are the first three lines:

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

My package description file includes a VignetteBuilder field:

VignetteBuilder: knitr

I think I'm following the instructions for Rnw vignettes , so I'm baffled by the error message I'm seeing.

Incidentally, if I try to build the vignette directly then everything seems to work perfectly. This command generates the vignette PDF:

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

My trouble seems to be only with R CMD build . Why won't the build work?

Here's my complete package DESCRIPTION file for reference:

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

According to the feedback of Josh O'Brien, I guess you might have the same issue as him. If you want to add some custom library paths, I'd recommend you to do it in ~/.Renviron using the environment variable R_LIBS_USER , instead of defining the library paths in ~/.Rprofile or Rprofile.site . The latter seems to be ignored by R CMD build and R CMD check .

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM