Re: [R] Is there a construct for conditional comment?

2009-08-21 Thread Stavros Macrakis
On Thu, Aug 20, 2009 at 1:27 PM, David Winsemiusdwinsem...@comcast.net wrote: ... But an extremely simple modification succeeds:  if ( 0 ) {  commented with zero  } else {  commented with one  } Returns: [1] \ncommented with one\n Yes, but of course that executes neither one nor the

Re: [R] Is there a construct for conditional comment?

2009-08-20 Thread Steve Jaffe
Why not if ( 0 ) { commented with zero } else { commented with one } Greg Snow-2 wrote: 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.

Re: [R] Is there a construct for conditional comment?

2009-08-20 Thread Greg Snow
Subject: Re: [R] Is there a construct for conditional comment? Why not if ( 0 ) { commented with zero } else { commented with one } Greg Snow-2 wrote: I believe that #if lines for C++ programs is handled by the preprocessor, not the compiler. So if you want the same

Re: [R] Is there a construct for conditional comment?

2009-08-20 Thread Duncan Murdoch
On 8/20/2009 11:54 AM, Steve Jaffe wrote: Why not if ( 0 ) { commented with zero } else { commented with one } Because that doesn't work unless the comments are syntactically correct R. For example, yours gives: Error in source(clipboard) : clipboard:2:11: unexpected symbol 1: if ( 0 ) {

Re: [R] Is there a construct for conditional comment?

2009-08-20 Thread David Winsemius
On Aug 20, 2009, at 1:19 PM, Duncan Murdoch wrote: On 8/20/2009 11:54 AM, Steve Jaffe wrote: Why not if ( 0 ) { commented with zero } else { commented with one } But an extremely simple modification succeeds: if ( 0 ) { commented with zero } else { commented with one } Returns: [1]

Re: [R] Is there a construct for conditional comment?

2009-08-19 Thread Greg Snow
...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Peng Yu Sent: Tuesday, August 18, 2009 3:55 PM To: r-h...@stat.math.ethz.ch Subject: [R] Is there a construct for conditional comment? Hi, In C++, I can

[R] Is there a construct for conditional comment?

2009-08-18 Thread Peng Yu
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

Re: [R] Is there a construct for conditional comment?

2009-08-18 Thread Duncan Murdoch
On 18/08/2009 5:54 PM, Peng Yu wrote: 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? No. The