[R] R and pointer

Simon Fear Simon.Fear at synequanon.com
Fri Aug 29 16:27:14 CEST 2003


foo <- function(y) assign(deparse(substitute(y)), y^2, parent.frame())

assigns to the calling frame. Or you could put the required frame as
a second argument.

> -----Original Message-----
> From: Barry Rowlingson [mailto:B.Rowlingson at lancaster.ac.uk]
> Cutting to what I think was the gist of the original poster's 
> question, 
> can I write a function, foo, that does this:
> 
>  > x <- 3
>  > foo(x)
>  > x
> [1] 9
> 
> for any x, in any situation? I'm guessing its doable, but ugly...
> 
> 
> Baz
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>
 

Simon Fear
Senior Statistician
Syne qua non Ltd
Tel: +44 (0) 1379 644449
Fax: +44 (0) 1379 644445
email: Simon.Fear at synequanon.com
web: http://www.synequanon.com
 
Number of attachments included with this message: 0
 
This message (and any associated files) is confidential and\...{{dropped}}




More information about the R-help mailing list