[R] Is there a construct for conditional comment?

Greg Snow Greg.Snow at imail.org
Wed Aug 19 19:12:53 CEST 2009

I believe that #if lines for C++ programs is handled by the preprocessor, not the compiler.  So if you want the same functionality for R programs, it would make sense to just preprocess the R file.

Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org

> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Peng Yu
> Sent: Tuesday, August 18, 2009 3:55 PM
> To: r-help at stat.math.ethz.ch
> Subject: [R] Is there a construct for conditional comment?
> Hi,
> In C++, I can use the following construct to choice either of the two
> blocks the comment but not both. Depending on whether the number after
> "#if" is zero or not, the commented block can be chose. I'm wondering
> if such thing is possible in R?
> #if 0
> commented with 0
> #else
> commented with 1
> #endif
> Regards,
> Peng
> ______________________________________________
> 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