[R] How to comment out multiple lines in R source code?

Prof Brian D Ripley ripley at stats.ox.ac.uk
Thu Oct 11 08:33:00 CEST 2001


On Wed, 10 Oct 2001, [iso-8859-1] Göran Broström wrote:

> On 10 Oct 2001 rossini at blindglobe.net wrote:
>
> > >>>>> "jl" == jonathan li <jonathan_li at agilent.com> writes:
> >
> >     jl> Hi, Is there a way to comment out multiple lines at once in R
> >     jl> source code like C language's /* */ struct? This is quite
> >     jl> useful when one is testing different sections of a source
> >     jl> code.
> >
> > One alternative is to use editor macros for this.
> >
> > (X)Emacs, when using ESS, supports comment-region and uncomment-region
> > commands.
> >
> > best,
> > -tony
>
> You may also try
>
> if (FALSE){
> ...
> ...
> }

Yes, you will see that in e.g. the MASS scripts to comment out S code that
does not (yet) work in R.

One warning: in that method the `commented' code has to syntactically
valid, and that has caught me more than once.   So I usually use ESS's
methods.

-- 
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