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