[R] Problem with a global variable

Gabor Grothendieck ggrothendieck at gmail.com
Tue Dec 4 06:59:38 CET 2007


You may wish to use the options command.  You can create
your own options, not just use pre-existing ones.

Please read the last line of every message to r-help.

On Dec 4, 2007 12:51 AM, Thomas L Jones, PhD <jones3745 at verizon.net> wrote:
> From: Thomas Jones
>
> I have several user-defined functions. As is standard practice, I am
> defining a logical vector named idebug in order to control debugging
> printouts. For example, if idebug [1] has the value TRUE, such-and-such
> debugging printouts are enabled. After the function works, some or all of
> the debugging printouts can be inhibited. idebug is a global variable;
> otherwise, it would have to be moved around with function arguments in a way
> which is clunky and hard to get right. However, I am getting an error
> message. This message was emitted during the loading of the program and is
> NOT inside any function.
>
> Or perhaps idebug wants a special slot on the search path.
>
> -------------------------------------------------------------------
>
> > debug_l <- 5 # length of debug vector
> > idebug <<- logical (5)
> > idebug [1] <<- TRUE
> Error in idebug[1] <<- TRUE : object "idebug" not found
> >
> [snip]
> ---------------------------------------------------------------
>
> Your advice?
>
> Tom Jones
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list