[BioC] silly question about writing own function

Sean Davis sdavis2 at mail.nih.gov
Wed Feb 28 17:55:13 CET 2007


On Wednesday 28 February 2007 11:38, James Anderson wrote:
> Hi,
>
> I have a rather simple question for writing my own function. Suppose I
> wrote a script "A" which called function B written by myself. Seems that I
> need to write the function B within the script A. Is there anyway to write
> B as a separate script (so that we have A and B two scripts within the same
> directory). I tried to do this but it seems that I must write function B
> within script A for them to work. I am very familiar with matlab, but new
> to R. I wonder how to do this, thanks.

R will not load scripts directly (it doesn't have a concept of the path, like 
matlab).  You simply need to source('B.R') before calling it in A.  See the 
help for source().

Sean



More information about the Bioconductor mailing list