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

2005-08-09 Thread Tuszynski, Jaroslaw W.
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  \
 [EMAIL PROTECTED] `\



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 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


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

2005-08-09 Thread Paul Roebuck
On Tue, 9 Aug 2005, Peter Yang wrote:

 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.

In your package's DESCRIPTION file, you should have an entry
that lists your package dependencies. Simply add the other
package there as well.

For example, to support the current version of R and a
package named foo, the entry would look like this:

Depends: R (= 2.1.1), foo

--
SIGSIG -- signature too long (core dumped)

__
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


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

2005-08-09 Thread Tuszynski, Jaroslaw W.
 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  \
 [EMAIL PROTECTED] `\


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
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. [EMAIL PROTECTED] 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  \
  [EMAIL PROTECTED] `\
 
 
 
 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] 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