[R] `acting' on variables

Spencer Graves spencer.graves at pdf.com
Wed Jul 9 21:30:16 CEST 2003


 > foo <- function(tiro){
+  tiro <- c(tiro, 3 * tiro)
+  tiro
+ }
 > foo(2)
[1] 2 6

Is this what you want?

spencer graves

Tobias Verbeke wrote:
> Dear list,
> 
> How can one "from within a function" act
> on these variables ("outside" a function)
> that were given as arguments.
> 
> If I have e.g. this beginning of a function:
> 
> foo <- function(tiro){
> app.tiro <- 3 * tiro
> 
> [...]
> 
> }
> 
> How can I from within the curly brackets
> e.g. concatenate the app.tiro to
> the particular variable I passed as the
> argument `tiro' ?
> 
> What is the technical name of this phenomenon ?
> 
> Thank you in advance,
> 
> 
> Tobias
> 
> PS forgive my non-programmer lingo
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help




More information about the R-help mailing list