On Mon, 20 Sep 2010, Johan Sandblom wrote:
In the modernized version of the R module (attached), which makes it
possible to interact with the statistical programming environment R
(http://www.r-project.org), mtxrun is used to call R on saved buffers
containing snippets of R code. Optionally, the output from R can be
included using \typefile. However, mtxrun includes a banner in the
output file, example below.
Why are you using input output redirection
R .... < \Rfile\space > \Rfile.out
rather than a simple
R .... \Rfile\space \Rfile.out
MTXrun |
MTXrun | executing: R -q --save --restore
MTXrun |
MTXrun |> sample(1:10)
[1] 5 3 1 9 2 6 10 8 4 7
sample(1:10, replace=TRUE)
[1] 1 10 7 1 7 5 2 2 10 5
See
http://archive.contextgarden.net/message/20100611.141914.fd6567be.en.html
but the banner still appears the first time mtxrun --ifchanged is run.
@Hans, mtxrun be completely silent when used to launch external
programs and only give some output if --verbose is passed.
BTW, there is a serious bug in the R module: each code chunck carries a
state with it (--save --restore), but this state can depend on which
chunck was changed.
Consider (I don't know the R syntax on top of my head, but this gives the
idea of the bug)
Chunk 1
\startR
a = 10 ;
b = 10 ;
\stopR
Chunk 2
\startR
a = 20 ;
b = 20
\stopR
Chunck 3
\startR
print(a+b) ;
\stopR
Run this once. The output will be 40. Now, add
c = 10 ;
in Chunk 1. Also change Chunk 3 to (add spaces so that md5 sum is
different)
print( a + b ) ;
Now run the file again. Since Chunk 2 is not changed, it will not be run.
Chunk 3 will see the state set by Chunk 1, and hence the output will be
20.
This "bug" can be avoided by doing some book keeping for the external
state (saving the file to a different name and restoring it), or by not
using --save and --restore.
Aditya
___________________________________________________________________________________
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 : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________