devol wrote:
> 
> Dear all,
> 
>   could you please advice whether it is possible somehow to modify an
> external (from the point of some function view) variable by some
> function-internal operators. For example
> 
>> var=1
>> foo<-function(var){var=var+1}
>> foo(var)
>> var
> [1] 1
> 
> but the goal is to get the var equal to 2 in this specific case. Maybe it
> is possible to set the var as some kind of global type and then it will be
> returned from the function as I want it to see... 
> 
> Thanks!
> 

?"<<-" 

although this should be used sparingly.  See section 6  of
<http://www.burns-stat.com/pages/Tutor/R_inferno.pdf> ...
-- 
View this message in context: 
http://www.nabble.com/modifications-of-out-of-the-function-variable-tp25803308p25803347.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to