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

Berend Hasselman bhh at xs4all.nl
Tue Sep 9 09:10:55 CEST 2014


On 09-09-2014, at 08:25, PO SU <rhelpmaillist at 163.com> wrote:

> 
> 
> I don't understand what's your meaning, do you mean that i should do some file processing,(like writing a script) ,so that i could add # in any line  i wanted. 
> I think it is not convenient.
> And, it does seems that there is no way to multi line comment in R. But when i turn to using Rstudio, after lots trying, i find that ctrl+shift+C can do the thing.


R only knows about single line comments. There is no multi line comment.
If you wish to comment several lines you will have to prefix each line with #.

Your editor may provide means of prefixing several lines with # by selecting lines and executing some command.
Rstudio provides Ctrl+Shift+C (Windows. Linux) and Cmd+Shift+C (OS X) on selected lines.
And other editors have other shortcuts.
You’ll just have to get used to this.

Berend

> Also i investgate roxygen, but it seems needing to learn the whole package ,  if some one happen to know how to do in roxygen, may you give me a quick reference?
> 
> 
> 
> 
> 
> 
> --
> 
> PO SU
> mail: desolator88 at 163.com 
> Majored in Statistics from SJTU
> 
> 
> 
> 
> At 2014-09-09 11:51:21, "Pascal Oettli" <kridox at ymail.com> wrote:
>> A workaround is to escape the evaluation of the lines. For example:
>> 
>> tt <- 0
>> while(tt > 0){
>> cat('rr\n')
>> }
>> 
>> Regards,
>> Pascal
>> 
>> On Tue, Sep 9, 2014 at 11:49 AM, 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.
>> 
>> 
>> 
>> -- 
>> Pascal Oettli
>> Project Scientist
>> JAMSTEC
>> Yokohama, Japan
> ______________________________________________
> 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