modernized and augmented m-r.tex
The ConTeXt module for interaction with the statistical programming language R currently does not work with MKIV since buffers are not saved to file. The included file fixes this by calling \savebuffer on the buffer in case \ctxlua is defined (a trick gleaned from a discussion on the LilyPond module a while back). Also, all calls to R used to include a rather annoying proc.time() statement at the end, and a modified R call has fixed this. PATH must contain R or R.exe on Windoze. Should 'texmfstart' still be used for the R calls? A third modification involves being able to call \startRnoecho (which only echoes R output in the ConTeXt file) in addition to \startR (which echoes both input and output) and \startRhidden (which echoes nothing, useful for generating graphics) One further improvement would be to collect the R snippets and run them all at once. That would significantly reduce processing time since the R startup is on the order of a few seconds. However, that is beyond my knowledge of ConTeXt. Regards, Johan -- Johan Sandblom, MD PhD m +46735521477 Sweden "What is wanted is not the will to believe, but the will to find out, which is the exact opposite" - Bertrand Russell
On Mon, Dec 8, 2008 at 12:59 PM, Johan Sandblom wrote:
One further improvement would be to collect the R snippets and run them all at once. That would significantly reduce processing time since the R startup is on the order of a few seconds. However, that is beyond my knowledge of ConTeXt.
More philosophical question than a question of implementation. If you want to generate some images with R than you can do that in one run anyway (you need to include those images with several \externalfigure commands anyway). If you want several ls() statements that print out something: how are you going to know which output belongs to which script? Mojca
2008/12/8 Mojca Miklavec
On Mon, Dec 8, 2008 at 12:59 PM, Johan Sandblom wrote:
One further improvement would be to collect the R snippets and run them all at once. That would significantly reduce processing time since the R startup is on the order of a few seconds. However, that is beyond my knowledge of ConTeXt.
More philosophical question than a question of implementation.
If you want to generate some images with R than you can do that in one run anyway (you need to include those images with several \externalfigure commands anyway). If you want several ls() statements that print out something: how are you going to know which output belongs to which script?
Yes it is interesting doing it this way, the latex people do it the other way around: they run a mixed R/LaTeX file through an R function that puts evaluated R code instead, run this file through LaTex and voila. But if there is no requirement for elegance I am sure there are ways to do it this way as well, some trickery with comments perhaps or searching for the next input. Rather a lot of work to get either of them going though ... Johan
Mojca ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
-- Johan Sandblom, MD PhD m +46735521477 Sweden "What is wanted is not the will to believe, but the will to find out, which is the exact opposite" - Bertrand Russell
participants (2)
-
Johan Sandblom
-
Mojca Miklavec