[R] How to link two R packages together
Joshua Wiley
jwiley.psych at gmail.com
Thu Aug 2 16:31:38 CEST 2012
Hi Bert,
Likewise, you may well be right. In fact, if I were going to assign
probabilities of being correct given the original post, I would give
you about .7 and me about .3. I commented for completeness of
discussion. I definitely see your point, and thank you for a
thoughtful reply to my post. I agree that many questions seem to me
that a quick read of the docs would solve them. That brings up an
interesting point, though. In a population of 100, if 1-2 people have
a preventable illness, we might be inclined to blame them; what if
40-50 people have the preventable illness? It seems to me lack of
reading the docs and following the posting guide are at epidemic
proportions. I do not know if it is a generation gap, true laziness,
lack of knowledge that the docs and posting guide _should_ be read
first, or ...
This is slightly OT, but I remember one time when I was working with
someone in person (not in R), and there was a question about how to
customize some graphic. I immediately went to open up the help files
but the person I was working with said, "I don't want look at the
documentation" and instead starting searching through a cookbook of
different graphs to try to find the answer. I was shocked because it
seemed like an innate visceral response to the official docs. Perhaps
our useRs are afflicted with this same condition.
Cheers,
Josh
On Thu, Aug 2, 2012 at 6:42 AM, Bert Gunter <gunter.berton at gene.com> wrote:
> Josh:
>
> You may be right ... but I still do not think so. Note that the post
> begins with:
>
> One of them (PKG1) needs to use the functions
>> of the other package (PKG2).
>
> This is exactly what imports are for. I believe that, because he/she
> failed to RTFM, he/she is not being accurate in his/her use of the
> relevant terms. Certainly, to me at least, it is unclear. Moreover, as
> I understand it (see the manual) imports are preferred over
> dependencies, as I indicated in my reply.
>
> Anyway, in either case, the central advice is that which both Michael
> and I gave: RTFM. Perhaps it's a generation gap (I am old), but I
> believe there has been a trend for new R users to post here without
> making any significant effort to consult the docs. This strikes me as
> intellectually lazy and, frankly, inconsiderate to those like yourself
> -- or BDR -- who are willing to give up their time and effort to help
> those with legitimate questions. You and others may consider this an
> overreaction of course.
>
> Sorry for the rant, but it seems relevant to your close parsing of the thread.
>
> -- Cheers,
> Bert
>
> On Wed, Aug 1, 2012 at 10:35 PM, Joshua Wiley <jwiley.psych at gmail.com> wrote:
>> On Wed, Aug 1, 2012 at 10:28 PM, Bert Gunter <gunter.berton at gene.com> wrote:
>>> On Wed, Aug 1, 2012 at 6:45 PM, Michael Weylandt
>>> <michael.weylandt at gmail.com> wrote:
>>>> Isn't this what package dependencies are for?
>>>
>>> No. It's what package imports are for (preferably).
>>> As always, the OP should RTFM -- in this case the one to which you
>>> refer on the next line, especially the NAMESPACES section.
>>
>> But note that the original question included, "when I load one package
>> using 'library("PKG1")', PKG2 can be loaded at the same." which
>> imports does not exactly do. They become available to the package, but
>> not to the user, so if you really need both packages loaded to the
>> search path, then you need a dependency, not imports.
>>
>> Cheers,
>>
>> Josh
>>
>>>
>>> -- Bert
>>>
>>>>
>>>> See the description of the DESCRIPTION file in Writing R Extensions
>>>>
>>>> Michael
>>>>
>>>> On Aug 1, 2012, at 5:27 PM, xuan zhao <xuan.zhao at sentrana.com> wrote:
>>>>
>>>>> Hi,
>>>>> I have built two R packages. One of them (PKG1) needs to use the functions
>>>>> of the other package (PKG2).
>>>>> So I need to link these two packages together, so that the functions of PKG2
>>>>> can be available to PKG1. And when I load one package using
>>>>> 'library("PKG1")', PKG2 can be loaded at the same.
>>>>> Any ideas welcome.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> View this message in context: http://r.789695.n4.nabble.com/How-to-link-two-R-packages-together-tp4638765.html
>>>>> Sent from the R help mailing list archive at Nabble.com.
>>>>>
>>>>> ______________________________________________
>>>>> R-help at r-project.org mailing list
>>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>>>>> and provide commented, minimal, self-contained, reproducible code.
>>>>
>>>> ______________________________________________
>>>> R-help at r-project.org mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>>
>>>
>>> --
>>>
>>> Bert Gunter
>>> Genentech Nonclinical Biostatistics
>>>
>>> Internal Contact Info:
>>> Phone: 467-7374
>>> Website:
>>> http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm
>>>
>>> ______________________________________________
>>> R-help at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>
>>
>>
>> --
>> Joshua Wiley
>> Ph.D. Student, Health Psychology
>> Programmer Analyst II, Statistical Consulting Group
>> University of California, Los Angeles
>> https://joshuawiley.com/
>
>
>
> --
>
> Bert Gunter
> Genentech Nonclinical Biostatistics
>
> Internal Contact Info:
> Phone: 467-7374
> Website:
> http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm
--
Joshua Wiley
Ph.D. Student, Health Psychology
Programmer Analyst II, Statistical Consulting Group
University of California, Los Angeles
https://joshuawiley.com/
More information about the R-help
mailing list