Re: [Rd] Vignette question

From: David L Lorenz <>
Date: Tue, 04 Sep 2012 09:54:02 -0500

  That does make sense. But then what does %\VignetteDepends{USGSgraphs} do if it does not actually make the library available from the temporary library tree?

Duncan Murdoch <> To:
David L Lorenz <>
09/04/2012 09:34 AM
Re: [Rd] Vignette question

On 04/09/2012 9:47 AM, David L Lorenz wrote:
> All,
> I seem to be missing some key point about the construction of
> I have created a vignette script that works fine when run interactively
> using Sweave. The top part of the .Rnw file is below.
> \documentclass{article}
> \parskip 3pt
> \parindent 30pt
> %\VignetteIndexEntry{Box Plot Examples}
> %\VignetteDepends{USGSgraphs}
> \begin{document}
> \title{Box Plot Examples}
> \author{Dave Lorenz}
> \maketitle
> ... text omittted from this example ...
> <<echo=TRUE>>=
> # Generate a random sample for the box plot
> set.seed(27036)
> BP <- rchisq(32, 3)
> # setSweave is a specialized function that sets up the graphics page
> setSweave("boxplot01", 6 ,6)
> # Set layout for 4 graphs
> AA.lo <- setLayout(width=rep(1.25, 4), height=4, xtop=1.5)
> ... remainder omitted ...
> The functions setSweave and setLayout are functions within the
> USGSgraphs library that I am building. As I said, the script runs just
> fine when I run interactively. I do have a version of the USGSgraphs
> library attached when I run the script. When I run R CMD check, or R CMD
> build on the source, I get the error:
> Error: processing vignette 'boxplots.Rnw' failed with diagnostics:
> chunk 1
> Error in eval(expr, envir, enclos) : could not find function "setSweave"
> Execution halted
> I would have expected that the contents of the library being built
> have been available to the script (based on section 1.3.2 in
> Barring that, I expected that "%\VignetteDepends{USGSgraphs}" would have
> made those functions available to the script. I have found that if I
> include this code before the first real example, it will run.
> <<echo=FALSE>>=
> library(USGSgraphs)
> @
> But I have no reason to believe that it would run on any system that
> not already have a version of USGSgraphs installed. Note that if I use
> default graphics output, then I get the same error on setLayout.
> I use the default process for building the vignettes--no makefile.
> What do I need to do to get this vignette to run? I know I can set
> BuildVignettes to FALSE in the DESCRIPTION file or try to build with the
> --no-vignettes option, but that does not really address the more general
> issue.

Vignettes are run in pretty standard R sessions when the package is built, so you need the explicit library(USGSgraphs) call to make functions from your package available in that session. What the manual is saying is just that that call will succeed: R will install a copy of your package in order to build the vignette. It goes into a "temporary library tree", because you might not want that particular version installed in your main tree.

Duncan Murdoch

        [[alternative HTML version deleted]] mailing list Received on Tue 04 Sep 2012 - 14:56:35 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 04 Sep 2012 - 18:50:42 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive