[R] R Commenting Style

Martin Maechler maechler at stat.math.ethz.ch
Thu Jan 19 17:20:53 CET 2006


>>>>> "Kevin" == Kevin E Thorpe <kevin.thorpe at utoronto.ca>
>>>>>     on Thu, 19 Jan 2006 06:26:31 -0500 writes:

    Kevin> I don't know if this is what you're referring to, but in ESS the number 
    Kevin> of octothorpes (#) affects the indentation in the emacs buffer. If I 
    Kevin> remember right, ### puts it at the beginning of the line, ## the current 
    Kevin> indentation level (eg. in a function) and # further right.

That's correct, thank you, Kevin,
and it's further supported by ESS in emacs,
e.g., if you comment a region (M-;) two  "#" are used
automatically.

There's also a little not well-known function
 M-x ess-fix-comments 
with documentation string
 "Fix ess-mode buffer so that single-line comments start with at least `##'."
and ess-fix-comments is implicitly called by the function
  M-x ess-MM-fix-src
which I use all the time when I get source files from some
people in order to ``clean them'' to my taste...

Note that a current (development) version of the ESS manual is
also only at the ESS website,
specifically,
    http://ess.r-project.org/Manual/ess.html
where the section on indenting (and the comments) is
    http://ess.r-project.org/Manual/ess.html#Indenting

I have exceptionally broken the rule of crossposting, and am
sending this to ESS-help mailing list as well, just to make sure
it'll be seen (and found) there as well.

Martin Maechler, ETH Zurich

    Kevin> Paul Roebuck wrote:

    >> I seem to remember reading somewhere about some style
    >> guide regarding R the number of comment characters (#)
    >> prior to the comment meaning something.
    >> 
    >> Anyone know to what I'm referring? Where?




More information about the R-help mailing list