[Rd] Vignette question

Duncan Murdoch murdoch.duncan at gmail.com
Tue Sep 4 19:40:11 CEST 2012


On 04/09/2012 10:54 AM, David L Lorenz wrote:
> Duncan,
>    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?

It's not documented to do anything.  I think it is supported purely for 
back compatibility.

Duncan Murdoch

> Dave
>
>
>
> From:
> Duncan Murdoch <murdoch.duncan at gmail.com>
> To:
> David L Lorenz <lorenz at usgs.gov>
> Cc:
> r-devel at r-project.org
> Date:
> 09/04/2012 09:34 AM
> Subject:
> 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
> vignettes.
> > 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
> would
> > have been available to the script (based on section 1.3.2 in
> R-exts.html).
> > 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
> did
> > not already have a version of USGSgraphs installed. Note that if I use
> the
> > 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
>
>
>



More information about the R-devel mailing list