On Thu, Aug 20, 2015 at 8:23 AM, Barry Rowlingson <
b.rowlingson at lancaster.ac.uk> wrote:
> On Wed, Aug 19, 2015 at 5:16 AM, Nathan Esau <nesau at sfu.ca> wrote:
> > I was wondering why the decision was made long ago to never implement
> > multi-line comments in R. I feel there are several argument to be made
> for
> > why the R language should have multi-line comments.
> >
> > 1. Many programming languages (including some which are commonly used
for
> > statistics, such as python, matlab and SAS) have this feature.
>
> Python doesn't have a multi-line comment.
>
> You can use triple-quoted strings in Python to quote a large chunk of
> text, which won't generate any bytecode and so has no executable
> effect:
>
> def foo(x)
> y = x * 2
> """
> well what now
> lets have a comment
> """
> return(y)
>
> A similar thing is possible in R:
>
> foo = function(x){
> "this is a test.
> where
> you can comment"
> return(x*2)
> }
>
> However I don't know if this causes any executable effect - its
> possible R evaluates the string in some way.... Anyone want to test.
>
>
Well, my guess is that the string, when created, would be interned in the
global string cache. That's unlikely to have any real bearing on anything R
is doing, but it is technically an effect.
Also, in the script case/top-level-expression it would affect .Last.value,
I think, though not in the particular case you posted.
~G
> Yes, you have to escape any string quote marks in your comment, but in
> python you have to escape any triple-quote marks.
>
> Barry
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
--
Gabriel Becker, PhD
Computational Biologist
Bioinformatics and Computational Biology
Genentech, Inc.
[[alternative HTML version deleted]]