Hello,
Is there an way to easy comment of sections of code? I was thinking
something along the lines of
\dontrun{
codeline 1
....
codeline k
}
but that could be used in regular script files. When I am still
working on a script, I often want to being using what is done, but I
would like the parts I am still working on not to be run when I use
source() on the file. I can set everything off with #, but that gets
to be tedious.
Thanks,
Josh
--
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.com/
if (FALSE) {
codeline 1
....
codeline k
}
On Fri, Jul 16, 2010 at 7:59 PM, Joshua Wiley
<jwiley.psych@gmail.com>wrote:
> Hello,
>
> Is there an way to easy comment of sections of code? I was thinking
> something along the lines of
>
> \dontrun{
> codeline 1
> ....
> codeline k
> }
>
> but that could be used in regular script files. When I am still
> working on a script, I often want to being using what is done, but I
> would like the parts I am still working on not to be run when I use
> source() on the file. I can set everything off with #, but that gets
> to be tedious.
>
> Thanks,
>
> Josh
>
> --
> Joshua Wiley
> Ph.D. Student, Health Psychology
> University of California, Los Angeles
> http://www.joshuawiley.com/
>
> ______________________________________________
> 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<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>
[[alternative HTML version deleted]]
On 07/16/2010 06:59 PM, Joshua Wiley wrote:> Hello, > > Is there an way to easy comment of sections of code? I was thinking > something along the lines of > > \dontrun{ > codeline 1 > .... > codeline k > } > > but that could be used in regular script files. When I am still > working on a script, I often want to being using what is done, but I > would like the parts I am still working on not to be run when I use > source() on the file. I can set everything off with #, but that gets > to be tedious.What editor do you use to edit R scripts? Many will have a way to add a comment character to each line of a highlighted region of code with one command.
I use XEmacs + ESS, and looking for ways to add text to a region of code, I see it is quite easy with C-x r t. Thanks for your great advice. On Fri, Jul 16, 2010 at 7:32 PM, Erik Iverson <eriki at ccbr.umn.edu> wrote:> On 07/16/2010 06:59 PM, Joshua Wiley wrote: >> >> Hello, >> >> Is there an way to easy comment of sections of code? ?I was thinking >> something along the lines of >> >> \dontrun{ >> codeline 1 >> .... >> codeline k >> } >> >> but that could be used in regular script files. ?When I am still >> working on a script, I often want to being using what is done, but I >> would like the parts I am still working on not to be run when I use >> source() on the file. ?I can set everything off with #, but that gets >> to be tedious. > > What editor do you use to edit R scripts? ?Many will have a way to add a > comment character to each line of a highlighted region of code with one > command. >-- Joshua Wiley Ph.D. Student, Health Psychology University of California, Los Angeles http://www.joshuawiley.com/
Joshua Wiley wrote:> I use XEmacs + ESS, and looking for ways to add text to a region of > code, I see it is quite easy > with C-x r t. Thanks for your great advice.or even M-x comment-region M-x uncomment-region These are commonly bound to C-c ; (because of LISP heritage), but not in (my version of) ESS. -- Peter Dalgaard Center for Statistics, Copenhagen Business School Phone: (+45)38153501 Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com