Hi,

Following a question about the broken R module (R the statistical software), Aditya suggested me the filter module (thanks to him). I’m about to distribute a set of course notes to colleagues, and I need to deal with details now. I have one problem and two questions.

1) the filter collect R code between \startR / \stopR and submit this code to R. As it can be seen in the following minimal example, when a label contains an accented character (« Fréquence » in my example), the pdf graphic does not contains the « é ». Strangely, the snippet of code (which is saved locally as « test2-temp-R-0.tmp » (for test2.tex)) when submitted with the same command as the filtercommand, works correctly; that means the same file works when submitted to R outside of ConTeXt. I have no idea how to solve this. 

2) In a teaching context, we may want sometimes to show the code. The filter module actually permits to show the output of the code submitted to R (which can include or not the input commands); would it be possible to typeset the submitted code ?

3) Finally, using "R CMD BATCH… » as the filtercommand add an extra line at the end of the output file which can be typeset to visualize results. Would it be possible by a magic trick to deleter the last line of the file ?

Here is a minimal code:
% —————————————————
\usemodule[filter]

\defineexternalfilter
  [R]
  [ filtercommand={R CMD BATCH -q --no-timing --save --restore \externalfilterinputfile\space \externalfilteroutputfile},
     output=\externalfilterbasefile.out,
     directory=output,
     readcommand=\typefile,
     read=no,
     cache=yes,
     purge=yes
   ]

\starttext

Some text...

\startR[read=yes]
   pdf("RPlots/MyHistogram.pdf",5,5)
   X <- rnorm(200,mean=10,sd=2)
   hist(X, col =  "red3" ,  xlab="Score QI" , main="", ylab="fréquence")
\stopR

\externalfigure[MyHistogram.pdf][width=.5\textwidth] 

\stoptext
% —————————————————

Sorry for the three questions… and thanks for any help.
Fabrice.


Attachment: MyHistogram.pdf
Description: Adobe PDF document

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to