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

2014-09-09 Thread PO SU

Tks for all your help,  finally i choose the way in Rstudio ctrl+shift+C, and 
do twice to cancel those comments. It's enough for me now. BTW, I also like the 
way:
if(FALSE) {}   :) 



--

PO SU
mail: desolato...@163.com 
Majored in Statistics from SJTU




At 2014-09-10 02:15:49, "Gjalt-Jorn Peters"  
wrote:
>In R-studio, you can also select whatever you want to comment out, and 
>press CTRL-SHIFT-C to comment the selection in one go.
>To uncomment it all in one go again, you can select it again and press 
>CTRL-SHIFT-C again.
>
>Gjalt-Jorn
>
>On 2014-09-09 5:51, Pascal Oettli 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  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: desolato...@163.com
>>> Majored in Statistics from SJTU
>>> __
>>> R-help@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@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@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.


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

2014-09-09 Thread Sven E. Templer
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  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 C :-).
>
> Duncan Murdoch
>
>
>>
>> I would also suggest making more functions that are smaller.
>> ---
>> Jeff NewmillerThe .   .  Go Live...
>> DCN:Basics: ##.#.   ##.#.  Live Go...
>>   Live:   OO#.. Dead: OO#..  Playing
>> Research Engineer (Solar/BatteriesO.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  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: desolato...@163.com
>>> Majored in Statistics from SJTU
>>> __
>>> R-help@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@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@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@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.


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

2014-09-09 Thread Gjalt-Jorn Peters
In R-studio, you can also select whatever you want to comment out, and 
press CTRL-SHIFT-C to comment the selection in one go.
To uncomment it all in one go again, you can select it again and press 
CTRL-SHIFT-C again.


Gjalt-Jorn

On 2014-09-09 5:51, Pascal Oettli 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  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: desolato...@163.com
Majored in Statistics from SJTU
__
R-help@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@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.


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

2014-09-09 Thread Bos, Roger
What I do in cases like that is wrap the code in a FALSE statement so it won't 
get executed:  its easy to add and remove as needed.

If (FALSE) {

...Code to exclude

}



***
This message and any attachments are for the named person's use only.
This message may contain confidential, proprietary or legally privileged
information. No right to confidential or privileged treatment
of this message is waived or lost by an error in transmission.
If you have received this message in error, please immediately
notify the sender by e-mail, delete the message, any attachments and all
copies from your system and destroy any hard copies. You must
not, directly or indirectly, use, disclose, distribute,
print or copy any part of this message or any attachments if you are not
the intended recipient.



-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of PO SU
Sent: Monday, September 08, 2014 10:50 PM
To: R. Help
Subject: [R] How to use multi paragraph comment like /* and */ in cpp?


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: desolato...@163.com
Majored in Statistics from SJTU
__
R-help@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@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.


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

2014-09-09 Thread Martin Maechler
> "PS" == PO SU 
> on Tue, 9 Sep 2014 10:49:32 +0800 writes:

PS> Dear expeRts,    I find it's terrible  when  i want to
PS> comment multi paragraph (e.g.  a 30 lines function) , i
PS> have to comment each line with #,  is there any good way
PS> to do that ?     I investgate it, but found no easy way,
PS> may you help me ?

Even though I can easily mark such a block and use the general
emacs  comment keyM-;
to comment each of those lines,
I often prefer

 if(FALSE) {

   ...
   ...
   ...

 }

which in the case of a single function definition which is only
one R expression can even do without the braces  {, }
and hence very easily activated/deactivated.

__
R-help@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.


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

2014-09-09 Thread Duncan Murdoch
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 C :-).

Duncan Murdoch


> 
> I would also suggest making more functions that are smaller.
> ---
> Jeff NewmillerThe .   .  Go Live...
> DCN:Basics: ##.#.   ##.#.  Live Go...
>   Live:   OO#.. Dead: OO#..  Playing
> Research Engineer (Solar/BatteriesO.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  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: desolato...@163.com 
>> Majored in Statistics from SJTU
>> __
>> R-help@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@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@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.


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

2014-09-09 Thread Pascal Oettli
No I don't mean this. Did you at least try the small example I provided?

On Tue, Sep 9, 2014 at 3:25 PM, PO SU  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.
> 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: desolato...@163.com
> Majored in Statistics from SJTU
>
>
>
>
> At 2014-09-09 11:51:21, "Pascal Oettli"  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  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: desolato...@163.com
>>> Majored in Statistics from SJTU
>>> __
>>> R-help@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



-- 
Pascal Oettli
Project Scientist
JAMSTEC
Yokohama, Japan

__
R-help@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.


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

2014-09-09 Thread Berend Hasselman

On 09-09-2014, at 08:25, PO SU  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: desolato...@163.com 
> Majored in Statistics from SJTU
> 
> 
> 
> 
> At 2014-09-09 11:51:21, "Pascal Oettli"  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  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: desolato...@163.com
>>> Majored in Statistics from SJTU
>>> __
>>> R-help@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@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@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.


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

2014-09-08 Thread PO SU


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.
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: desolato...@163.com 
Majored in Statistics from SJTU




At 2014-09-09 11:51:21, "Pascal Oettli"  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  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: desolato...@163.com
>> Majored in Statistics from SJTU
>> __
>> R-help@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@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.


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

2014-09-08 Thread Pascal Oettli
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  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: desolato...@163.com
> Majored in Statistics from SJTU
> __
> R-help@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@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.


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

2014-09-08 Thread Jeff Newmiller
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.

I would also suggest making more functions that are smaller.
---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.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  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: desolato...@163.com 
>Majored in Statistics from SJTU
>__
>R-help@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@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.