From: Aditya Mahajan <adityam@umich.edu>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Removing banner from mtxrun output
Date: Mon, 20 Sep 2010 05:17:30 -0400 (EDT) [thread overview]
Message-ID: <alpine.LNX.2.00.1009200505300.13138@ybpnyubfg.ybpnyqbznva> (raw)
In-Reply-To: <AANLkTi=UHKN8kL06Otd6eivxqKthxcnSUc1_-xmiXiYy@mail.gmail.com>
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
___________________________________________________________________________________
next prev parent reply other threads:[~2010-09-20 9:17 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-20 8:26 Johan Sandblom
2010-09-20 8:44 ` luigi scarso
2010-09-20 9:23 ` Aditya Mahajan
2010-09-20 20:56 ` Johan Sandblom
2010-09-21 18:44 ` Johan Sandblom
2010-09-21 19:28 ` Peter Münster
2010-09-21 20:18 ` Aditya Mahajan
2010-09-21 20:37 ` Johan Sandblom
2010-09-21 20:45 ` Hans Hagen
2010-09-20 9:17 ` Aditya Mahajan [this message]
2010-09-20 20:02 ` Johan Sandblom
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LNX.2.00.1009200505300.13138@ybpnyubfg.ybpnyqbznva \
--to=adityam@umich.edu \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).