Skip to content
Prev 45483 / 63424 Next

missing exported methods when compiling vignettes in R 3.0.0 RC

Hi,

things have indeed changed on how non-Sweave vignettes are built (this
happened around R devel 2013-03-05 r62130).  However, it's not clear
to me what changes would be behind your problems, if any.

Build your vignette with the following buildVignette(), which emulates
what R does when it builds vignettes (cf. tools::buildVignettes()).
As you'll see, it reproduces your error:

if (!exists("buildVignette", mode="function")) {
  source("http://r-forge.r-project.org/scm/viewvc.php/*checkout*/pkg/R.rsp/R/buildVignette.R?root=r-dots");
}

EXAMPLE (in a fresh R session):

url <- "http://r-forge.r-project.org/scm/viewvc.php/*checkout*/pkg/BayesFactorPCL/vignettes/manual.Rmd?root=bayesfactorpcl"
if (!file.exists("manual.Rmd")) download.file(url, "manual.Rmd");

output <- buildVignette("manual.Rmd", buildPkg="knitr");
browseURL(output);

bfr <- readLines(output);
idxs <- grep("which.max(bf)", bfr, fixed=TRUE);
idxs <- sort(sapply(idxs, FUN=function(idx) idx+(-5:5)));
cat(sprintf("%03d: %s\n", idxs, bfr[idxs]));
2517: </code></pre>
2518:
2519: <pre><code>## [1] TRUE
2520: </code></pre>
2521:
2522: <pre><code class="r">BayesFactor::which.max(bf)
2523: </code></pre>
2524:
2525: <pre><code>## complaints
2526: ##          1
2527: </code></pre>
2531:
2532: <pre><code>## critical + advance
2533: ##                 21
2534: </code></pre>
2535:
2536: <pre><code class="r">which.max(bf)
2537: </code></pre>
2538:
2539: <pre><code>## Error: no method for coercing this S4 class to a vector
2540: </code></pre>
2541:

So, have a look at browseVignette() and how it calls the 'knitr' weave
function.  That should help you narrow down what's going on.
R version 3.0.0 RC (2013-03-31 r62463)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages:
[1] tools     stats     graphics  grDevices utils     datasets  methods
[8] base

other attached packages:
[1] BayesFactor_0.9.3 markdown_0.5.4    coda_0.16-1       lattice_0.20-15
[5] knitr_1.1.7

loaded via a namespace (and not attached):
[1] digest_0.6.3     evaluate_0.4.3   formatR_0.7      grid_3.0.0
[5] mvtnorm_0.9-9994 pbapply_1.0-5    stringr_0.6.2

Hope this helps

/Henrik
On Mon, Apr 1, 2013 at 4:52 PM, Richard D. Morey <r.d.morey at rug.nl> wrote: