You can, if you want, use stand-alone lines for multi-line comments—— I always thought it was prettier than if (FALSE) { } . The string will be evaluated and then discarded, since until the last line in the function nothing will happen.
"This function takes a value x, and does things and returns things that take several lines to explain" doEverythingOften <- function(x) {
The main limitation is that when you comment on a material, you have to look at your quotation marks: if you have one view inside, you will have to use another view for comment; and if you have something like "lines with" post-lines "inside this block, then there is no way for this method to be a good idea. But then there is still an if (FALSE) block.
Another limitation that both methods have is that you can only use such blocks only in places where the expression is syntactically correct - without commenting on parts of the lists, say.
Regarding what the IDE does: I'm a Vim user, and I find NERD Commenter a great tool for quickly commenting or decoding multiple lines. Very comfortable, very well documented.
Finally, the R prompt (at least under Linux) has a nice Alt - Shift - # to comment on the current line. It is very nice to put the line “on hold” if you are working with one liner, and then you understand that you need to prepare the step first.
Esteis Nov 09 '10 at 19:47 2010-11-09 19:47
source share