[R] How to use multi paragraph comment like /* and */ in cpp?

Sven E. Templer sven.templer at gmail.com
Tue Sep 9 14:49:20 CEST 2014


One way I know to do this is (in bash) to use a dummy variable and make the
comment a multiline character string:

dummy <- c("
This is my multiline
comment or code block.
")

or if printing does not disturb you, just use:

"
...
"

Use ' if you have " in the block.
Other workarounds are here, which you find when using a search engine:
http://stackoverflow.com/questions/1231195/multiline-comment-workarounds

Hope this helps.

@Duncan: sorry sending the mail to you twice.

Sven

On 9 September 2014 13:43, Duncan Murdoch <murdoch.duncan at gmail.com> wrote:
> On 08/09/2014, 11:14 PM, Jeff Newmiller wrote:
>> There are no multi line comment markers in R. However, since you are always referring to RStudio you might want to look into roxygen, since their editor supports that tool.
>
> RStudio has a command to comment a block:  it's in the Code menu.  (On
> my Mac the shortcut is <unprintable><unspeakable>C :-).
>
> Duncan Murdoch
>
>
>>
>> I would also suggest making more functions that are smaller.
>> ---------------------------------------------------------------------------
>> Jeff Newmiller                        The     .....       .....  Go Live...
>> DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
>>                                       Live:   OO#.. Dead: OO#..  Playing
>> Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
>> /Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
>> ---------------------------------------------------------------------------
>> Sent from my phone. Please excuse my brevity.
>>
>> On September 8, 2014 7:49:32 PM PDT, PO SU <rhelpmaillist at 163.com> wrote:
>>>
>>> Dear expeRts,
>>>    I find it's terrible  when  i want to comment multi paragraph (e.g.
>>> a 30 lines function) , i have to comment each line with #,  is there
>>> any good way to do that ?
>>>    I investgate it, but found no easy way, may you help me ?
>>>
>>>
>>>
>>>
>>>
>>> --
>>>
>>> PO SU
>>> mail: desolator88 at 163.com
>>> Majored in Statistics from SJTU
>>> ______________________________________________
>>> R-help at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list