[R] question

TEMPL Matthias Matthias.Templ at statistik.gv.at
Mon Jun 7 14:11:42 CEST 2004


> Hello,
> 
> I'd like to know if I can modify a constant value with a function.
> 
> Example :
> 
> a=4
> 
> f1<-function()
> {a=3}
> 
> Of course, after the function f1() is executed , the value of 
> a is always 4. I'd like the value returned is 3, like it is 
> possible in C by doing *a=3
> 
Use return:

f1 <- function()
{a=3; return(a)}


Matthias




More information about the R-help mailing list