Skip to content
Back to formatted view

Raw Message

Message-ID: <438B182B.1070800@statistik.uni-dortmund.de>
Date: 2005-11-28T14:46:03Z
From: Uwe Ligges
Subject: How define global Variable?
In-Reply-To: <20051128142649.C0CAC718794@basicbox6.server-home.net>

svenknueppel at reilich.net wrote:

> Hello,
> 
> I try to define a global variable.

You should not do that unless you really know why you want it this way. 
You probably want to read the R Language Definition manual.

Anyway, read ?assign if you want to proceed doing dangerous things.

Uwe Ligges



> My example:
> 
> R> a <- "old"
> R> test <- function () { a <- "new" }
> R> test()
> R> a # shoud be "new"
> 
> This doesn't work. I would like to modify the variable "a" in a
> procedure. How can I do that.
> 
> Thank you for helping.
> 
> Sven Kn??ppel (Germany-Berlin)
> 
> 
> 
> ------------------------------------------------------------------------
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html