Emoticons with code blocks other than R?

I often use Sweave to create LaTeX documents where certain pieces are produced dynamically by executing R code. This works well, but it is also possible to have pieces of code that execute in different ways, for example. by executing code in a shell, or by running Perl, etc.? It would be useful to be able to mix things, so I could do things like running some shell commands to extract some data, running some perl commands for preprocessing, and then running R commands to parse it.

Of course, I could use all the R fragments and use system() as a replacement for the poor, but that does not make a very pleasant reading in the document.

+6
shell r sweave
source share
5 answers

It is not directly related to Sweave, but org-babel, which is part of org-mode Emacs, allows you to mix code fragments of different languages ​​in one file, transfer data from one fragment to another, execute it and generate LaTeX or HTML export from output.

You can find more information about org-mode here:

http://www.orgmode.org/

And see how org-babel works:

http://orgmode.org/worg/org-contrib/babel/

+4
source share

New news (for multilingual, multi-format) documents can be dexy.it , which, for example, these guys at opengamma.org use as a backend.

Ana , who is behind dexy, also gives a lot of talk about it, and also take a look at the dexy blog .

+5
source share

Of course, there is no easy way to do this, except through interfaces with a foreign language from R (possibly through inline , if supported), or system() . What is it worth, I would just use system() ; it should be simple enough.

You can see this previous question about the Python equivalent of Sweave , where one of the respondents actually creates a separate interface. This may give you an idea of ​​what it takes to implement other languages ​​that may not be supported. At a minimum, you need to make a big hack for the Sweave driver.

+3
source share

Do you know emacs " org-mode and more specifically Babel ? If you already know Emacs or want to upgrade to Emacs, then org-mode and Babel are the answer to your question (s).

For example, I am currently working on a document that contains some shell scripts, performs calculations with R, and creates flowcharts with a dot (graphviz). Org mode can export various formats, for example. LaTeX (this is what I use).

+3
source share

There is a StatWeave project that uses java, not R to weave, but will run several programs, not just R. I don’t know how hard it would be to get it to do Perl or other programs like this, but the home page shows that she already works with R, SAS, Stata and others:

http://www.cs.uiowa.edu/~rlenth/StatWeave/

+2
source share

All Articles