Re: [Rd] Best practices - R CMD check and vignettes

From: James W. MacDonald <jmacdon_at_med.umich.edu>
Date: Wed, 19 Sep 2007 16:17:16 -0400

Thanks, Max. Right after sending that email I was frantically searching for the 'Retract' button on my mailer, but evidently there isn't one ;-D.

Anyway, I'm not sure the entire package is installed during either R CMD build or R CMD check, so I am not sure that will work. My ill-advised idea of hard-coding the path won't work either, since the path will be different for these two steps.

However, the obvious fix that occurred to me 1 nanosecond after hitting 'send' was that the saved objects should just be in the /inst/doc directory with the .Rnw files instead of being in some other directory. Originally I had the raw data in the /examples directory so users of my package could practice using those data, but really I think the only use is for building the vignettes, so moving to /inst/doc appears the most reasonable course of action.

Best,

Jim

Kuhn, Max wrote:
> 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, M.S.
Biostatistician
Affymetrix and cDNA Microarray Core
University of Michigan Cancer Center
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
Received on Wed 19 Sep 2007 - 20:21:20 GMT

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 Wed 19 Sep 2007 - 22:41:26 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.