Re: [R] how to use the function from another package

From: Tuszynski, Jaroslaw W. <JAROSLAW.W.TUSZYNSKI_at_saic.com>
Date: Wed 10 Aug 2005 - 05:13:54 EST


> Thanks very much for your help. Do I still have to write library( ) to
load the library in my code after I add a "depends" field in the DESCRIPTION file?

No,

First when user of your package downloads it (at least on Windows machines) all required packages are also downloaded (this mechanism sometimes needs manual help, but that is another story). Then when he loads your package (by calling library(YourPackage)) all required packages are loaded into R.

One good way to research this kind of questions (other than documentation and R-Help) is to study source code of other people packages.    

Jarek

====================================================\=======

 Jarek Tuszynski, PhD.                           o / \ 
 Science Applications International Corporation  <\__,|  
 (703) 676-4192                                   ">   \
 Jaroslaw.W.Tuszynski@saic.com                     `    \


-----Original Message-----
From: peterwyang@gmail.com [mailto:peterwyang@gmail.com] Sent: Tuesday, August 09, 2005 2:57 PM
To: Tuszynski, Jaroslaw W.
Subject: Re: [R] how to use the function from another package

Thanks very much for your help. Do I still have to write library( ) to load the library in my code after I add a "depends" field in the DESCRIPTION file? Thanks.

Peter

On 8/9/05, Tuszynski, Jaroslaw W. <JAROSLAW.W.TUSZYNSKI@saic.com> wrote:
> See "Writing R Extensions" / Creating R package / Description file /
> "depends" field (section 1.1.1).
>
> Jarek
> ====================================================\=======
>
> Jarek Tuszynski, PhD. o / \
> Science Applications International Corporation <\__,|
> (703) 676-4192 "> \
> Jaroslaw.W.Tuszynski@saic.com ` \
>
>
>
> -----Original Message-----
> From: r-help-bounces@stat.math.ethz.ch
> [mailto:r-help-bounces@stat.math.ethz.ch] On Behalf Of Peter Yang
> Sent: Tuesday, August 09, 2005 1:56 PM
> To: R-help@stat.math.ethz.ch
> Subject: [R] how to use the function from another package
>
> Hi, I am trying to write a package(A) for myself and need to use a
> function from another package(B) which is in R already(need to install
> it before use). Could anyone tell me how to implement that? Also I
> hope that my package gives an ERROR message(something like "STOP,
> please install package B first") if the package B is not installed
> yet. It is my first time to write a package. Thanks very much for your
help.
>
> Peter
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Aug 10 05:18:22 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 15:11:50 EST