[R] using object reference

Rajarshi Guha rxg218 at psu.edu
Tue Mar 2 23:22:08 CET 2004

On Tue, 2004-03-02 at 17:16, Andy Bunn wrote:
> Don't you just need to use return?
> x <- 1
> attr(x,'a') <- 'some text'
> f <- function(z) {
>   attr(z,'a') <- 'some new text'
>   return(z)
> }
> y <- f(x)
> y

Well what I'm trying to is to pop up a Tk window and allow the user to
add some text which gets placed into the attribute of the variable
passed to the function.

So basically i have a Tk toplevel window with a text area and a button.
When the button is clicked the callback gets the text area contents and
places it into the attribute of the supplied variable and destroys the

I tried returning the variable but it did'nt work (and it seemed less
elegant than allowing the function directly modify the passed in

Rajarshi Guha <rxg218 at psu.edu> <http://jijo.cjb.net>
GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE
Chemistry professors never die, they just fail to react.

More information about the R-help mailing list