The problem is that the a is within the function
You can easily solve this by
test <- function () { a <- "new"; return(a) }
a=test()
Best regards,
Kristel
(or test <- function () { return(a <- "new")})
[EMAIL PROTECTED] wrote:
> Hello,
>
> I try to define a global variable.
>
> 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)
>
>
>
> ------------------------------------------------------------------------
>
> ______________________________________________
> [email protected] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
--
__________________________________________
Kristel Joossens Ph.D. Student
Research Center ORSTAT K.U. Leuven
Naamsestraat 69 Tel: +32 16 326929
3000 Leuven, Belgium Fax: +32 16 326732
E-mail: [EMAIL PROTECTED]
http://www.econ.kuleuven.be/public/ndbae49
Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html