[R] Silly Question

Agustin Lobo alobo at ija.csic.es
Thu Apr 18 14:28:38 CEST 2002


(I reply to Mark's reply as I went too fast
deleting the original message).

Ricardo,

Assuming your text file "saludos.R" has 2 R functions, i.e.

"hola" <- function()
{ 
	print ("HOLA")
}

"adios" <- function()
{ 
	print ("ADIOS")
}

if you do in R:
> source("/directory_info/saludos.R")

functions hola() and adios() will become
available in your def. environment
as you can check with ls(), and just
run as hola() and adios().

(I think the problem might be that source() is
used for two very different goals: run a demo
and "load" functions strored in ascii files.
The name "source" seems not intuitive for the
second purpose and often confuses beginers).


Agus

Dr. Agustin Lobo
Instituto de Ciencias de la Tierra (CSIC)
Lluis Sole Sabaris s/n
08028 Barcelona SPAIN
tel 34 93409 5410
fax 34 93411 0012
alobo at ija.csic.es


On Thu, 18 Apr 2002, Mark Myatt wrote:

> Ricardo Gonçalves <ricardo at icmc.sc.usp.br> writes:
> 
> >After I source an R code, how can I call the function?
> 

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list