From Max.Kuhn at pfizer.com  Wed Sep 19 21:02:58 2007
From: Max.Kuhn at pfizer.com (Kuhn, Max)
Date: Wed, 19 Sep 2007 15:02:58 -0400
Subject: [Rd] Best practices - R CMD check and vignettes
In-Reply-To: <46EF40D5.7050807@med.umich.edu>
Message-ID: <71257D09F114DA4A8E134DEAC70F25D3098FC226@groamrexm03.amer.pfizer.com>

Jim,

But I'm not sure if this works if the package has not been installed (or
it might find a version already installed in your library path), but
give it a try:

   load(system.file("examples", "somedata.Rdata", package = "PkgName"))

Max 

-----Original Message-----
From: r-devel-bounces at r-project.org
[mailto:r-devel-bounces at r-project.org] On Behalf Of James MacDonald
Sent: Monday, September 17, 2007 11:07 PM
To: r-devel at stat.math.ethz.ch
Subject: [Rd] Best practices - R CMD check and vignettes

Hi,

I have a package that contains two vignettes that both use saved objects

in the examples directory of the package. With previous versions of R I 
could have a code chunk in the vignette like this:

<<echo=false>>=
load("../examples/somedata.Rdata")
@

followed by a code chunk like

<<eval=false>>=
foo <- bar("data")
@

that simulated the actual reading in of the data (I use a saved object 
to limit package size).

This passed check with previous versions of R, but under R-2.6.0alpha, 
the vignettes are dumped into an inst directory in the <package>.Rcheck 
directory, where Sweave() and texi2dvi() are run. Unfortunately, the 
above code chunks no longer work.

I can certainly hard code the first chunk to find the .Rdata file, but I

have to imagine there is a much more elegant way to do this.

Any suggestions?

Best,

Jim


-- 
James W. MacDonald, MS
Biostatistician
UMCCC cDNA and Affymetrix Core
University of Michigan
1500 E Medical Center Drive
7410 CCGC
Ann Arbor MI 48109
734-647-5623

______________________________________________
R-devel at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] Best practices - R CMD check and vignettes
Kuhn, Max