commenting lines (was [R] Drawing Trig Function)

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed May 31 13:37:40 CEST 2000


> Date: Wed, 31 May 2000 22:27:06 +1200
> From: Ko-Kang Wang <Ko-Kang at xtra.co.nz>
> 
> Just out of curiousity, why is it I can't do multiple commenting in R.  I have
> to type # in front of each line (well, it's true).  If there are 20 or more
> lines it becomes a bit annoying.
> 
> In SAS there is /* blah blah blah */, which comments out an entire block.
> Java and C++ have the similar feature too.  Will it be possible to put this
> feature in R in the future?

There are a couple of conventions here.  C uses /* blah blah blah */,
but as I understand it // rest of line is preferred in C++.  Indeed,
there is some tendency for C++ programmers to find it convenient in C,
and gcc lets it be used.  Perl uses # rest of line and TeX (and Rd) %
rest of line, and Visual Basic ' rest of line and ...

With a good code editor none of these are any problem.  There is no
reason to write many lines of comments in R code: that's what the .Rd
file is for.  And if you want to temporarily delete a block, 
if(0) { ... } will work, as indeed will temporarily deleting in an editor.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list