[R] How to comment in R

Waclaw.Marcin.Kusnierczyk at idi.ntnu.no Waclaw.Marcin.Kusnierczyk at idi.ntnu.no
Wed Feb 11 11:47:28 CET 2009


> Hi Mihai,
>
> one (very bad style) way would be
>
> if (FALSE) {
>    comment
>    comment
>    comment
> }
>

this works only if the enclosed text is syntactically valid r code.  that
is, you can't have multiline free text comments done this way, neither can
you temporarily comment out unfinished and unparsable code.

an extension to the parser that would accept multiline start-end comment
tags, be it c-style /* */, perl-style =pod =cut, whatever, should be
fairly  trivial to implement.  (the perl-style pod markup is particularly
easy to parse, because it suffices to recognize '^=' on a line, no
advanced pattern-matching needed.)

somewhat surprising there is no such functionality there in r (or is there
any?), it would be quite convenient.

vQ




More information about the R-help mailing list