[Bioc-devel] Zipped Rdata files in windows binaries

Robert Gentleman rgentlem at fhcrc.org
Fri Feb 6 21:56:15 CET 2009


Hi,

On Fri, Feb 6, 2009 at 11:05 AM, Tarca, Adi <atarca at med.wayne.edu> wrote:
>
>
> Hi all,
> I am writing an R packge and at a given point I need to load an Rdata file from the "data" folder of the installed package, and in case the file it is not there I try to download it from somwhere.
>
  That does not sound like a good thing to do.  The data folder is
exclusively for data that is stored essentially at package build time
and is not a place to put other files, or to use during a session to
store objects.  Objects there are platform independent and are
accessed using the data command in R.  Please don't try to modify this
behavior.

   If you want/need to have your own data storage type and want to
control it, you should use a different folder.  A common choice is
inst/extdata.  And then you are in control of everything.

   Since lots of people use R in cases where they do not have access
to the internet, the idea that they should download something for your
package to work seems problematic.  Why not just use one of
the many platform independent formats and distribute the data on all
platforms in the same way.

   There are a number of examples in Bioconductor packages (eg
simpleaffy or flowCore)

  Best wishes
    Robert


> I used to do the following test to see if a file called "datload" is NOT there, case in which I need to download it:
>
>  if(! paste(datload,".RData",sep="") %in% dir(system.file("data",package="SPIA"))) {
>  ...download the file from somwhere else
> }
>
> It works fine except that the windows binary package created by bioconductor scripts from my source, puts all RData file in a Rdata.zip file. Is there a way to list the files in Rdata.zip to see if my file is in there?
>
> Alternatively I tried to use the data() function and try to load it (in a private environment), and in case it is not loaded  then try to download it. However, the data() function does not return an error but only a warning.
> I tried to use:
>
> ow <- options("warn")
> options(warn=2) # to make warnings into errors
> errs<-try(data(list=datload, envir=.myDataEnv),silent=TRUE)
>
>  if(class(errs)!="try-error"){
>  ...download the file from somwhere else
>  }
>
> This works fine, except that a warning is still printed when the function returns.
>
> Any ideas would be appreciated.
>
>
> Thanks,
> Adi Laurentiu Tarca
>
> _______________________________________________
> Bioc-devel at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel
>
>



-- 
Robert Gentleman, PhD
Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M2-B876
PO Box 19024
Seattle, Washington 98109-1024
206-667-7700
rgentlem at fhcrc.org



More information about the Bioc-devel mailing list