[NTG-context] Filter module for R

Fabrice L fabrice.alpha at gmail.com
Mon Jun 15 05:26:28 CEST 2020


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:
% —————————————————

  [ filtercommand={R CMD BATCH -q --no-timing --save --restore \externalfilterinputfile\space \externalfilteroutputfile},


Some text...

   X <- rnorm(200,mean=10,sd=2)
   hist(X, col =  "red3" ,  xlab="Score QI" , main="", ylab="fréquence")


% —————————————————

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20200614/56ced92f/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MyHistogram.pdf
Type: application/pdf
Size: 4518 bytes
Desc: not available
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20200614/56ced92f/attachment.pdf>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20200614/56ced92f/attachment-0001.htm>

More information about the ntg-context mailing list