From murdoch.duncan at gmail.com  Tue Sep  4 19:40:11 2012
From: murdoch.duncan at gmail.com (Duncan Murdoch)
Date: Tue, 04 Sep 2012 13:40:11 -0400
Subject: [Rd] Vignette question
In-Reply-To: <OF25814930.7B34DFC2-ON86257A6F.0051B408-86257A6F.0051DAD3@usgs.gov>
References: <mailman.17.1346752805.30578.r-devel@r-project.org>
	<5045F221.7050600@mayo.edu>
	<OF16428985.E6D7F237-ON86257A6F.0045BFC3-86257A6F.004BBB53@usgs.gov>
	<50461135.6010307@gmail.com>
	<OF25814930.7B34DFC2-ON86257A6F.0051B408-86257A6F.0051DAD3@usgs.gov>
Message-ID: <50463CFB.6040901@gmail.com>

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
>
>
>



[Rd] Vignette question
Duncan Murdoch