[R] How to comment in R

Gustaf Rydevik gustaf.rydevik at gmail.com
Wed Feb 11 14:41:05 CET 2009


On Wed, Feb 11, 2009 at 2:15 PM, baptiste auguie <ba208 at exeter.ac.uk> wrote:
> A somewhat twisted approach that has not been mentioned is to consider
> everything a comment unless it is enclosed in special tags, as done in the
> brew package,
>
> for example,
>
>
>>  brew(textConnection(
>> "You won't see this R output, but it will run. <% foo <- 'bar' %>
>>  Now foo is <%=foo%> and today is <%=format(Sys.time(),'%B %d, %Y')%>."
>>  ) )
>
> gives,
>
>> You won't see this R output, but it will run.
>> Now foo is bar and today is February 11, 2009.
>
>
> I'd love to see an editor with a "brew" mode that acts as a notebook: you
> type in your text in whatever language without worrying about the syntax (R
> syntax, i mean!), and when you want to do a calculation you just enclose it
> in such tags that behave like an inverted block comment.
>
> Just a thought,
>
> baptiste
>


Isn't this almost exactly what ?Sweave does? (and  odfWeave).
Granted, you have to deal with latex code to get nice output, but
latex is a GoodThing (tm).

/Gustaf

-- 
Gustaf Rydevik, M.Sci.
tel: +46(0)703 051 451
address:Essingetorget 40,112 66 Stockholm, SE
skype:gustaf_rydevik




More information about the R-help mailing list