[Bioc-devel] include data from non self-sufficient .R files

Laurent Gatto laurent.gatto at gmail.com
Tue Oct 12 09:39:57 CEST 2010


Hi Sean,

On 12 October 2010 00:15, Sean Davis <sdavis2 at mail.nih.gov> wrote:
>
>
> On Mon, Oct 11, 2010 at 6:58 PM, Laurent Gatto <laurent.gatto at gmail.com>
> wrote:
>>
>> Dear all,
>>
>> I have some data to be included in a package. The data needs to be
>> easily loadable by the users, optimally with data(), and consists of a
>> set of class instances, classes that are defined in the package
>> itself.
>> Something like:
>> myData1 <- new("aClass",...) ## in myData1.R
>> myData2 <- new("aClass",...) ## in myData2.R
>>
>> that I would like to be loadable with
>>
>> data(myData1)
>> data(myData2)
>>
>> Although putting the .R files that generate the data objects directly
>> in the data directory would be the simplest solution, I can not this
>> because the code is not self-sufficient. I can't figure out how to
>> easily and automatically include these.
>> What is the suggested way to include this kind of data in a package?
>>
>> Thank you very much in advance.
>>
>
> Hi, Laurent.
> You can save() your data objects and put them in your data directory.  That
> should do it.  Of course, you will want to document them, also.  You can
> look at the "Writing R Extensions" manual for more details.
> Sean
>

Thank you for the advice. I was rather looking for an automatic way of
including the objects at installation time, as the code is readily
available in the package. But as the class and these objects are not
likely to change too much in the future, adding them once manually is
fine, of course.
By the way, I tried to have an R source (in ints/scripts/ or R/)
create the instances and save() them in data/, but without success.

Best wishes,

Laurent



More information about the Bioc-devel mailing list