[R] variable definition

Gabor Grothendieck ggrothendieck at myway.com
Sun Jul 11 18:47:04 CEST 2004


Wolski <wolski <at> molgen.mpg.de> writes:

> 
> Hallo!
> ?assign
> 
> z<-"now"
> assign(paste("go", z, sep = ".") ,10)

Assuming that you wish to create a variable called go.now with the
value of 10 in the caller environment to f:

   R> f <- function(z) assign(paste("go", z, sep = "."), 10, parent.frame())
   R> f("now")
   R> go.now
   [1] 10




More information about the R-help mailing list