[R] is there an equivalent for #ifdef (C langage) in R

Gabor Grothendieck ggrothendieck at gmail.com
Thu Jan 12 21:06:29 CET 2012


On Thu, Jan 12, 2012 at 12:12 PM, William Dunlap <wdunlap at tibco.com> wrote:
> You could put your debug-only code into a function calls like
>   ifDebug(diagnosticPlot(c))
> and
>   ifDebug({
>        tmp <- timeConsumingFunction(c)
>        stopifnot(tmp < 1.0)
>   })
> When you want debug output define ifDebug as
>   ifDebug <- function(expr) force(expr)
> and when you don't want it define it as
>   ifDebug <- function(expr) NULL

or even

ifDebug <- force

for the first one.

-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com



More information about the R-help mailing list