[R] On-demand importing of a package

Gabor Grothendieck ggrothendieck at gmail.com
Fri Nov 25 18:40:30 CET 2011


On Fri, Nov 25, 2011 at 11:52 AM, Jakson Alves de Aquino
<jalvesaq at gmail.com> wrote:
> On Fri, Nov 25, 2011 at 1:21 PM, Gabor Grothendieck
> <ggrothendieck at gmail.com> wrote:
>
> [...]
>
>> I was framing this in terms of the Matrix example, but perhaps its
>> easier to understand with the actual example which motivated this for
>> me.  That is, the feature is that whenever sqldf is installed then
>> RSQLite is installed too without having RSQLite automatically load
>> when sqldf loads.
>
> [...]
>
> 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.


-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com



More information about the R-help mailing list