[Bioc-devel] Loading a file for vignette

J.Oosting at lumc.nl J.Oosting at lumc.nl
Mon Feb 26 17:19:21 CET 2007


Hi Sean,

I did something like this in the vignette for the beadarraySNP package,
and have probably seen it once somewhere else. 
The files are originally in a directory 'testdata' within the 'inst'
directory. During package installation all contents of the 'inst'
directory are copied to the package directory.
In the vignette I then use the following lines to show the content of
the file. 

<<Samplesheet>>=
datadir <- system.file("testdata", package="beadarraySNP")
readLines(paste(datadir,"4samples_opa4.csv",sep="/"))
@

Jan

> 
> I would like to make a vignette that will instruct the user 
> to load a file from a package distribution using one of the 
> packages R functions.  The file is not a .txt file (or any of 
> the other file types that should be in the data directory of 
> a package).  Of course, the vignette needs to build and I 
> would like to have those commands be the same as those used 
> by the user.  I have looked around a bit and the packages 
> that I have found do a simple
> load(somedata) where somedata is an R data file.  Is there a 
> way to start directly from the original file, or am I better 
> off creating the R object and loading it and simply telling 
> the user how I created it?  This is a VERY small point, but 
> I'm curious.
> 
> Thanks,
> Sean
>



More information about the Bioc-devel mailing list