[R] On-demand importing of a package

Jakson Alves de Aquino jalvesaq at gmail.com
Fri Nov 25 20:47:56 CET 2011


On Fri, Nov 25, 2011 at 2:40 PM, Gabor Grothendieck
<ggrothendieck at gmail.com> wrote:
>> I think that the following procedure has the result that you want:
>>
>> Put in the DESCRIPTION file:
>>
>> Imports: RSQLite
>>
>> And in the R code write something like:
>>
>> RSQLite::AnRSQLiteFunction()
>
> I had been thinking of using Imports in DESCRIPTION but was concerned
> that that would put RSQLite objects ahead of everything else on
> sqldf's search path even when not wanted but I gather you are
> intending that Imports be used in DESCRIPTION: but _not_ in the
> NAMESPACE file.  I think that that would likely work. I will test it
> out to be sure. What I would probably want to do is to require()
> RSQLite in case the user wants to mix sqldf and RSQLite calls and I
> will check whether the check procedure allows that if the package is
> only named in Imports but, if not, it might be sufficient to put
> RSQLite in both Imports and Suggests.  Thanks.

I have done this with the 'descr' package. It wasn't necessary to put
the imported packages in two places, only in the "Imports" field. This
was enough to make R install all dependencies but not load then along
with 'descr'.

-- 
Jakson Alves de Aquino
Federal University of Ceará
Social Sciences Department
www.lepem.ufc.br/aquino.php



More information about the R-help mailing list