[R] Very important! Global variables in R?
Hello @all R-Help-User. I need urgently your assistance!!! I need a global variable in R. The variable ought to be known for every functions and subfunctions. It is only to comparison purposes of the numeric algorithms. Is there a possibility? please answer in german if possible. thank you in advance. Christian Hinz -- * Christian Hinz Wickrather Str. 230 41236 Mönchengladbach 02166/125369 * -- * Christian Hinz Wickrather Str. 230 41236 Mönchengladbach 02166/125369 __ R-help@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
Re: [R] Very important! Global variables in R?
On 1/24/06 8:15 AM, "Christian Hinz" <[EMAIL PROTECTED]> wrote: > Hello @all R-Help-User. > > I need urgently your assistance!!! > I need a global variable in R. The variable ought to be known for every > functions and subfunctions. It is only to comparison purposes of the > numeric algorithms. Is there a possibility? > > please answer in german if possible. a <- 1 is in your workspace, so it is "global" in the sense that it is accessible to functions. Be sure to read http://cran.r-project.org/doc/manuals/R-intro.html for more information Sean __ R-help@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
Re: [R] Very important! Global variables in R?
On Tue, 24 Jan 2006, Sean Davis wrote: > > > > On 1/24/06 8:15 AM, "Christian Hinz" <[EMAIL PROTECTED]> wrote: > > > Hello @all R-Help-User. > > > > I need urgently your assistance!!! > > I need a global variable in R. The variable ought to be known for every > > functions and subfunctions. It is only to comparison purposes of the > > numeric algorithms. Is there a possibility? > > > > please answer in german if possible. And consider reading Uwe Ligges' book: http://www.statistik.uni-dortmund.de/~ligges/PmitR/ for access to German-language information. > > a <- 1 > > is in your workspace, so it is "global" in the sense that it is accessible > to functions. Be sure to read > > http://cran.r-project.org/doc/manuals/R-intro.html > > for more information > > Sean > > __ > R-help@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 > -- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: [EMAIL PROTECTED] __ R-help@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
Re: [R] Very important! Global variables in R?
"Sean Davis" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > I need urgently your assistance!!! > > I need a global variable in R. The variable ought to be known for every > > functions and subfunctions. It is only to comparison purposes of the > > numeric algorithms. Is there a possibility? > > > > please answer in german if possible. Es tut mir leid. Ich kann Deutsch nicht sprechen. > > a <- 1 If you make that assignment inside a function, it won't be known outside the funtion, so "a" is not really global here. Global assignment x <<- 5 ?"<<-" BUT, be aware of these cautions about the use of global variables: "I wish <<- had never been invented, as it makes an esoteric and dangerous feature of the language *seem* normal and reasonable. If you want to dumb down R/S into a macro language, this is the operator for you." -- Bill.Venables, R-Help, July 30, 2001 #thomas (tlumley), R-Help, Jan 24, 2001 This is one of the acceptable uses of <<-, as shown in demo(scoping). <<- is useful for modifying a variable that you know exists in the enclosing environment. Most of the problems come from people trying to use it to modify things in a parent environment or in the global environment. Also see Section 13.3 "Global Data" in "Code Complete 2" (http://www.cc2e.com/) including: - Common Problems with Global Data - Use Global Data Only as a Last Resort - How to Reduce the Risks of Using Global Data efg __ R-help@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