On 27.04.2008, at 19:29, baptiste auguie wrote:
I've been tempted for a while to try Sweave, but it still feels like a lot of pain to write and read this mixture of LaTeX and R chunks syntax. I think there is an html driver now, but this is not pretty either. What about (Multi)Markdown? It seems to me it would be a nice way to write reports about R projects. Has it been tried by any of you TM users?
Hmm. Do you mean something like: write a Markdown doc containing let's say a key tag @RCODE@; while converting the doc to HTML, LaTeX, etc. a parser would execute the @RCODE@ chunks and inserts the result in Markdown style before it will be post-processed?
--Hans
exactly! (i realize now i forgot to mention what I meant, thanks for clarifying)
Is this doable?
--- En date de : Dim 27.4.08, Hans-Jörg Bibiko bibiko@eva.mpg.de a écrit :
De: Hans-Jörg Bibiko bibiko@eva.mpg.de Objet: Re: [TxMt] R, Sweave, markdown À: bapt_4510@yahoo.fr, "TextMate users" textmate@lists.macromates.com Date: Dimanche 27 Avril 2008, 16h48 On 27.04.2008, at 19:29, baptiste auguie wrote:
I've been tempted for a while to try Sweave, but
it still feels
like a lot of pain to write and read this mixture of
LaTeX and R
chunks syntax. I think there is an html driver now,
but this is not
pretty either. What about (Multi)Markdown? It seems to me it would be a nice way to write reports
about R
projects. Has it been tried by any of you TM users?
Hmm. Do you mean something like: write a Markdown doc containing let's say a key tag @RCODE@; while converting the doc to HTML, LaTeX, etc. a parser would execute the @RCODE@ chunks and inserts the result in Markdown style before it will be post-processed?
--Hans
__________________________________________________ Do You Yahoo!? En finir avec le spam? Yahoo! Mail vous offre la meilleure protection possible contre les messages non sollicités http://mail.yahoo.fr Yahoo! Mail
In principal it won't be such a big deal to write such a parser. But the problems will appear in the details. One has to create a kind of meta syntax - processing statements - for all these R chunks. E.g.
@RCODE quiet@ a <- matrix(c(1,2,3,4,5,6), nrow=2 byrow=T) @/RCODE@
foo foo
@RCODE insertAsTable noCommandLine@ print(a*2) @/RCODE@
etc.
But this would be mean to reinvent the wheel twice in some sense. Markdown to LaText and Sweave for LaTeX works fine.
On the other hand I use quite often the R bundle command 'Execute Selection/Document in R and' > 'Insert Result' for such things.
Of course, to have such a pre-parser for expanding R code chunks and insert the result depending on the current language (HTML, LaTeX, Markdown, Plain Text) would be nice.
--Hans
Hi again,
I'm not very familiar with Sweave, but I was under the impression that the principle of it –– actually, as a special case of noweb files ––, would allow one to define new drivers without worrying about the parsing. There is a LaTeX one, an HTML one, and I think an OpenOffice thing one. I think the function Rtangle would extract and execute the R chunks in any source file, it it then a matter of integrating the output to the Markdown syntax.
Maybe this is actually more a question to ask on the R-mailing list.
cheers,
baptiste
--- En date de : Lun 28.4.08, Hans-Jörg Bibiko bibiko@eva.mpg.de a écrit :
De: Hans-Jörg Bibiko bibiko@eva.mpg.de Objet: Re: [TxMt] R, Sweave, markdown À: "TextMate users" textmate@lists.macromates.com Cc: bapt_4510@yahoo.fr Date: Lundi 28 Avril 2008, 3h53 In principal it won't be such a big deal to write such a parser. But the problems will appear in the details. One has to create a kind of meta syntax - processing statements - for all these R chunks. E.g.
@RCODE quiet@ a <- matrix(c(1,2,3,4,5,6), nrow=2 byrow=T) @/RCODE@
foo foo
@RCODE insertAsTable noCommandLine@ print(a*2) @/RCODE@
etc.
But this would be mean to reinvent the wheel twice in some sense. Markdown to LaText and Sweave for LaTeX works fine.
On the other hand I use quite often the R bundle command 'Execute Selection/Document in R and' > 'Insert Result' for such things.
Of course, to have such a pre-parser for expanding R code chunks and insert the result depending on the current language (HTML, LaTeX, Markdown, Plain Text) would be nice.
--Hans
__________________________________________________ Do You Yahoo!? En finir avec le spam? Yahoo! Mail vous offre la meilleure protection possible contre les messages non sollicités http://mail.yahoo.fr Yahoo! Mail
On Apr 29, 2008, at 9:59 AM, baptiste auguie wrote:
Hi again,
I'm not very familiar with Sweave, but I was under the impression that the principle of it –– actually, as a special case of noweb files ––, would allow one to define new drivers without worrying about the parsing. There is a LaTeX one, an HTML one, and I think an OpenOffice thing one. I think the function Rtangle would extract and execute the R chunks in any source file, it it then a matter of integrating the output to the Markdown syntax.
Maybe this is actually more a question to ask on the R-mailing list.
It certainly is possible to use Sweave with something other than LaTeX, but someone would have to write the driver. On the other hand, writing in Markdown with <<...>> .... @ blocks for the R and figure code should work just fine, you then just: 1) Run the file through MultiMarkdownToLaTeX to get a LaTeX file with these blocks still there. The tricky part here is getting MultimarkdownToLaTeX to not touch the <...>...@ blocks, though that should be doable I think. Perhaps someone more familiar with the script can tell us how to do that (I believe it would amount to adding some XSLT transformations?) 2) Pass the resulting LaTeX file through the standard Sweave process, to get a pdf 3) There's no step 3.
Of course, if you want something like an HTML output, that's another story, though shouldn't be too bad. Perhaps one can have a look at how the R help files (I believe they have a .Rd format) get converted to HTML help pages. Also it would be nice to have the equivalent of \Sexpr{...}. Probably amounts to just another XSLT transformation.
Just some thoughts Haris Skiadas Department of Mathematics and Computer Science Hanover College
cheers,
baptiste
--- En date de : Lun 28.4.08, Hans-Jörg Bibiko bibiko@eva.mpg.de a écrit :
De: Hans-Jörg Bibiko bibiko@eva.mpg.de Objet: Re: [TxMt] R, Sweave, markdown À: "TextMate users" textmate@lists.macromates.com Cc: bapt_4510@yahoo.fr Date: Lundi 28 Avril 2008, 3h53 In principal it won't be such a big deal to write such a parser. But the problems will appear in the details. One has to create a kind of meta syntax - processing statements - for all these R chunks. E.g.
@RCODE quiet@ a <- matrix(c(1,2,3,4,5,6), nrow=2 byrow=T) @/RCODE@
foo foo
@RCODE insertAsTable noCommandLine@ print(a*2) @/RCODE@
etc.
But this would be mean to reinvent the wheel twice in some sense. Markdown to LaText and Sweave for LaTeX works fine.
On the other hand I use quite often the R bundle command 'Execute Selection/Document in R and' > 'Insert Result' for such things.
Of course, to have such a pre-parser for expanding R code chunks and insert the result depending on the current language (HTML, LaTeX, Markdown, Plain Text) would be nice.
--Hans