Re: [NTG-context] Difficulties using the r module

2006-07-09 Thread Matthew Routley
The resolution to my problem was specific to Mac OS X and had nothing to do
with the R module in particular. In case others have a similar problem, here
is my solution.

First, write18 must be enabled. As described by Aditya Mahajan, edit
/usr/local/teTeX/texmf.cnf so that shell_escape = t.

Second, create a texmfstart script as described in the Configuration of
texmfstart section of http://wiki.contextgarden.net/Mac_Installation. I
modified this slightly by placing the script in ~/bin so that I didn't
interfere with the installed teTeX tree.

Now the r module works.

Thanks for everyone's help with this.

Matt

___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] Difficulties using the r module

2006-07-05 Thread Matthew Routley
I can confirm that this works from the command line:

R CMD BATCH -q --save --restore rsample-r-1.tmp rsample-r-1.tmp.out

using the sample file from the r module. Running this command for each of the r
segments will produce the desired output. What I haven't determined is how to 
modify the r module \runR command. Simply replacing the current \runR with

\def\runR {\executesystemcommand{texmfstart
 --ifchanged=\Rfile\space --direct R CMD BATCH 
 -q --save --restore \Rfile\space \Rfile.out}}

was not successful. But I'm quite unfamilier with ConTeXt at this level.

As far as I can determine, the appropriate .out files are not being created,
which the log file correctly indicates. The .tmp files are successfully 
extracted
 from the source file.

Thanks for the help with this.

Matt



___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] Difficulties using the r module

2006-07-05 Thread Johan Sandblom
I think some quoting is required:

\def\runR
  {\executesystemcommand{texmfstart
  --ifchanged=\Rfile\space --direct R CMD BATCH
  -q --save --restore \Rfile\space \Rfile.out}}

works here, but then I am on Linux. I think eventually Mac expertise
may be required.

Johan


2006/7/5, Matthew Routley [EMAIL PROTECTED]:
 I can confirm that this works from the command line:

 R CMD BATCH -q --save --restore rsample-r-1.tmp rsample-r-1.tmp.out

 using the sample file from the r module. Running this command for each of the 
 r
 segments will produce the desired output. What I haven't determined is how to
 modify the r module \runR command. Simply replacing the current \runR with

 \def\runR {\executesystemcommand{texmfstart
  --ifchanged=\Rfile\space --direct R CMD BATCH
  -q --save --restore \Rfile\space \Rfile.out}}

 was not successful. But I'm quite unfamilier with ConTeXt at this level.

 As far as I can determine, the appropriate .out files are not being created,
 which the log file correctly indicates. The .tmp files are successfully 
 extracted
  from the source file.

 Thanks for the help with this.

 Matt



 ___
 ntg-context mailing list
 ntg-context@ntg.nl
 http://www.ntg.nl/mailman/listinfo/ntg-context



-- 
Johan Sandblom  N8, MRC, Karolinska sjh
t +46851776108  17176 Stockholm
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
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] Difficulties using the r module

2006-07-05 Thread Johan Sandblom
I now discovered a side effect of using the R CMD BATCH invocation
instead of the piping. With the CMD R outputs the setting of options
in the first line and the result of proc.time at the end. Perhaps not
a problem, but it does require three more typed lines per R block.

Johan

2006/7/5, Johan Sandblom [EMAIL PROTECTED]:
 I think some quoting is required:

 \def\runR
   {\executesystemcommand{texmfstart
   --ifchanged=\Rfile\space --direct R CMD BATCH
   -q --save --restore \Rfile\space \Rfile.out}}

 works here, but then I am on Linux. I think eventually Mac expertise
 may be required.

 Johan


 2006/7/5, Matthew Routley [EMAIL PROTECTED]:
  I can confirm that this works from the command line:
 
  R CMD BATCH -q --save --restore rsample-r-1.tmp rsample-r-1.tmp.out
 
  using the sample file from the r module. Running this command for each of 
  the r
  segments will produce the desired output. What I haven't determined is how 
  to
  modify the r module \runR command. Simply replacing the current \runR with
 
  \def\runR {\executesystemcommand{texmfstart
   --ifchanged=\Rfile\space --direct R CMD BATCH
   -q --save --restore \Rfile\space \Rfile.out}}
 
  was not successful. But I'm quite unfamilier with ConTeXt at this level.
 
  As far as I can determine, the appropriate .out files are not being created,
  which the log file correctly indicates. The .tmp files are successfully 
  extracted
   from the source file.
 
  Thanks for the help with this.
 
  Matt
 
 
 
  ___
  ntg-context mailing list
  ntg-context@ntg.nl
  http://www.ntg.nl/mailman/listinfo/ntg-context
 


 --
 Johan Sandblom  N8, MRC, Karolinska sjh
 t +46851776108  17176 Stockholm
 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



-- 
Johan Sandblom  N8, MRC, Karolinska sjh
t +46851776108  17176 Stockholm
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
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] Difficulties using the r module

2006-07-05 Thread Johan Sandblom
I get no such output, either to stdout or in the log, in fact nothing
even similar. Does the ...disabled indicate that it is not run,
possibly because of something TeX/ConTeXt-related?

Johan

2006/7/5, Matthew Routley [EMAIL PROTECTED]:
 Johan Sandblom jsandblom at gmail.com writes:

  I think some quoting is required:
 
  \def\runR
{\executesystemcommand{texmfstart
--ifchanged=\Rfile\space --direct R CMD BATCH
-q --save --restore \Rfile\space \Rfile.out}}
 
  works here, but then I am on Linux. I think eventually Mac expertise
  may be required.

 Unfortunately, the quoting doesn't help. Closer inspection of the log file
 reveals lines such as:

 system(texmfstart --ifchanged=test-r-1.tmp --direct R CMD BATCH -q
 --save --restore test-r-1.tmp test-r-1.tmp.out)...disabled.

 with both the original \runR and new, batch mode.

 Matt

 ___
 ntg-context mailing list
 ntg-context@ntg.nl
 http://www.ntg.nl/mailman/listinfo/ntg-context



-- 
Johan Sandblom  N8, MRC, Karolinska sjh
t +46851776108  17176 Stockholm
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
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] Difficulties using the r module

2006-07-05 Thread Aditya Mahajan
On Wed, 5 Jul 2006, Matthew Routley wrote:

 Johan Sandblom jsandblom at gmail.com writes:

 I think some quoting is required:

 \def\runR
   {\executesystemcommand{texmfstart
   --ifchanged=\Rfile\space --direct R CMD BATCH
   -q --save --restore \Rfile\space \Rfile.out}}

 works here, but then I am on Linux. I think eventually Mac expertise
 may be required.

 Unfortunately, the quoting doesn't help. Closer inspection of the log file
 reveals lines such as:

 system(texmfstart --ifchanged=test-r-1.tmp --direct R CMD BATCH -q
 --save --restore test-r-1.tmp test-r-1.tmp.out)...disabled.

 with both the original \runR and new, batch mode.

This means that write18 is disabled on your system, so tex cannot 
execute any system commands. This is a security feature and most 
intallation disable write18 by default. You need to edit your 
texmf.cnf file to enable it. Search for texmf.cnf using

texmfstart --locate texmf.cnf

open that file in your favourite editor.

Search for shell_escape and set it to true by

shell_escape = t

Save the file and write18 should work.

Rerun texexec on your file and look at the log file. You should get

system() executed.


Aditya
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] Difficulties using the r module

2006-07-05 Thread Matthew Routley
Aditya Mahajan adityam at umich.edu writes:
 This means that write18 is disabled on your system, so tex cannot 
 execute any system commands. This is a security feature and most 
 intallation disable write18 by default. You need to edit your 
 texmf.cnf file to enable it. Search for texmf.cnf using
 
 texmfstart --locate texmf.cnf
 
 open that file in your favourite editor.
 
 Search for shell_escape and set it to true by
 
 shell_escape = t

This worked for enabling the commands. Of course, this revealed a new
problem. texmfstart was not being called correctly. Replacing texmfstart
with:

ruby /usr/local/teTeX/share/texmf.local/scripts/context/ruby/texmfstart.rb

, which is my path to texmfstart.rb, in \runR solved the problem.

I had followed the Other method from the ConTeXt wiki for enabling
texmfstart on my system. This works fine for calling commands from
the command line, but (as suggested in the wiki) doesn't necessarily
work for other methods.

Once I sort out all of these OS X specific details, I'll post back to my 
original
message with a solution.

Thanks,
Matt




___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] Difficulties using the r module

2006-07-03 Thread Hans Hagen
Johan Sandblom wrote:
 \def\runR {\executesystemcommand{texmfstart --ifchanged=\Rfile\space
 --direct R CMD BATCH -q --save --restore \Rfile\space \Rfile.out}}

 or some such, I do not really understand the quoting. The invocation
 should change, options should not and redirectors should go away. Not
 sure if this is better or worse in any way.

   
the quoting tells texmfstart not split this,   | are passes ok that way

did you test it?

Hans


___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] Difficulties using the r module

2006-07-02 Thread Johan Sandblom
2006/7/2, Hans Hagen [EMAIL PROTECTED]:
 Johan Sandblom wrote:
  I can't really think why it wouldn't work then. Perhaps it is to do
  with \write18 and the right of TeX to run external programs? Or maybe
  R on the mac does not take the same command-line options? In that case
  the output of the texexec run should be revealing. R takes more than a
  second to start up so there are noticable breaks in the output after
  which error messages from R appear. Btw, the reason it does not work
  on contextgarden is likely that R is not installed there.
 
 one problem could be that R has this piping; i wonder why a program that
 takes a 50 meg installation does not support something --output or i
 must have missed something

I think R is most commonly used interactively in which case it is not
needed. Anyway, OS X is a unix-alike so it should work fine. It even
works on Windoze! The R MAC FAQ
http://cran.r-project.org/bin/macosx/RMacOSX-FAQ.html#Command-line-version-of-R
indicates that this approach should work.

Johan

 Hans


 --

 -
   Hans Hagen | PRAGMA ADE
   Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
  | www.pragma-pod.nl
 -




-- 
Johan Sandblom  N8, MRC, Karolinska sjh
t +46851776108  17176 Stockholm
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
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] Difficulties using the r module

2006-07-02 Thread Olaf Mersmann
Hi Hans,

* Hans Hagen [EMAIL PROTECTED] [060702 13:25]:
 one problem could be that R has this piping; i wonder why a program that 
 takes a 50 meg installation does not support something --output or i 
 must have missed something

R does support redirecting output to a file. Use

  R CMD BATCH [options] infile outfile

-- Olaf
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] Difficulties using the r module

2006-07-02 Thread Hans Hagen
Olaf Mersmann wrote:
 Hi Hans,

 * Hans Hagen [EMAIL PROTECTED] [060702 13:25]:
   
 one problem could be that R has this piping; i wonder why a program that 
 takes a 50 meg installation does not support something --output or i 
 must have missed something
 

 R does support redirecting output to a file. Use

   R CMD BATCH [options] infile outfile
   
currently we use:

\def\runR {\executesystemcommand{texmfstart --ifchanged=\Rfile\space 
--direct R -q --save --restore  \Rfile\space  \Rfile.out}}

so how should it look then?

Hans


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-

___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] Difficulties using the r module

2006-07-02 Thread Johan Sandblom
\def\runR {\executesystemcommand{texmfstart --ifchanged=\Rfile\space
--direct R CMD BATCH -q --save --restore \Rfile\space \Rfile.out}}

or some such, I do not really understand the quoting. The invocation
should change, options should not and redirectors should go away. Not
sure if this is better or worse in any way.

Johan

2006/7/2, Hans Hagen [EMAIL PROTECTED]:
 Olaf Mersmann wrote:
  Hi Hans,
 
  * Hans Hagen [EMAIL PROTECTED] [060702 13:25]:
 
  one problem could be that R has this piping; i wonder why a program that
  takes a 50 meg installation does not support something --output or i
  must have missed something
 
 
  R does support redirecting output to a file. Use
 
R CMD BATCH [options] infile outfile
 
 currently we use:

 \def\runR {\executesystemcommand{texmfstart --ifchanged=\Rfile\space
 --direct R -q --save --restore  \Rfile\space  \Rfile.out}}

 so how should it look then?

 Hans


 -
   Hans Hagen | PRAGMA ADE
   Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
  | www.pragma-pod.nl
 -

 ___
 ntg-context mailing list
 ntg-context@ntg.nl
 http://www.ntg.nl/mailman/listinfo/ntg-context



-- 
Johan Sandblom  N8, MRC, Karolinska sjh
t +46851776108  17176 Stockholm
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
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] Difficulties using the r module

2006-07-01 Thread Johan Sandblom
I can't really think why it wouldn't work then. Perhaps it is to do
with \write18 and the right of TeX to run external programs? Or maybe
R on the mac does not take the same command-line options? In that case
the output of the texexec run should be revealing. R takes more than a
second to start up so there are noticable breaks in the output after
which error messages from R appear. Btw, the reason it does not work
on contextgarden is likely that R is not installed there.

Sorry I could not be of more assistance, Johan

2006/6/30, Matthew Routley [EMAIL PROTECTED]:
 Johan,

  It appears R is not found. Is it on the path? Does it have the same
  name on the Mac?

 Yes, R is in the bath and is found in /usr/bin/R which is a link to
 /Library/Frameworks/R.framework/Resources/bin/R.

 Thanks for your help with this.

 Take care,
 Matt

 --
 Matthew Routley
 http://matt.routleynet.org
 ___
 ntg-context mailing list
 ntg-context@ntg.nl
 http://www.ntg.nl/mailman/listinfo/ntg-context



-- 
Johan Sandblom  N8, MRC, Karolinska sjh
t +46851776108  17176 Stockholm
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
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


[NTG-context] Difficulties using the r module

2006-06-28 Thread Matthew Routley
I spotted the announcement of the use of R in ConTeXt and was quite interested
in trying it out. However, so far I haven't been able to get it to work. It
appears that R is not being called by texexec and the .tmp.out are not being
found, despite the fact that they are being produced.

Are there more details on installing and using this module? I think it would
be quite useful.

Thanks for any advice,
Matt

Some details are that I am using Mac OS X 10.4.7, R-2.3.1, and ConTeXt ver:
2006.06.28 from gwTeX and running the sample file contained in m-r.tex.

I have also tried using context live @ contextgarden.net with the same results
as on my personal machine.

Here is some output from the log file: system :

module r loaded
(/usr/local/teTeX/share/texmf.local/tex/context/base/m-r.tex)

...

systems : begin file r at line 11 r-r-1.tmp
(/usr/local/teTeX/share/texmf.local/tex/context/base/pdfr-ec.tex) verbatim :
file r-r-1.tmp.out does not exist r-r-2.tmp verbatim : file r-r-2.tmp.out
does not exist r-r-3.tmp r-r-4.tmp verbatim : file r-r-4.tmp.out does not
exist r-r-5.tmp verbatim : file r-r-5.tmp.out does not exist r-r.tmp
(./r-r.tmp figures : figure ushape can not be found floatblocks : 1 placed )
r-r-6.tmp verbatim : file r-r-6.tmp.out does not exist r-r.tmp (./r-r.tmp
figures : figure lattice can not be found floatblocks : 2 placed ) r-r-7.tmp
verbatim : file r-r-7.tmp.out does not exist

...

___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] Difficulties using the r module

2006-06-28 Thread Johan Sandblom
It appears R is not found. Is it on the path? Does it have the same
name on the Mac?

Regards, Johan

2006/6/28, Matthew Routley [EMAIL PROTECTED]:
 I spotted the announcement of the use of R in ConTeXt and was quite interested
 in trying it out. However, so far I haven't been able to get it to work. It
 appears that R is not being called by texexec and the .tmp.out are not being
 found, despite the fact that they are being produced.

 Are there more details on installing and using this module? I think it would
 be quite useful.

 Thanks for any advice,
 Matt

 Some details are that I am using Mac OS X 10.4.7, R-2.3.1, and ConTeXt ver:
 2006.06.28 from gwTeX and running the sample file contained in m-r.tex.

 I have also tried using context live @ contextgarden.net with the same results
 as on my personal machine.

 Here is some output from the log file: system :

 module r loaded
 (/usr/local/teTeX/share/texmf.local/tex/context/base/m-r.tex)

 ...

 systems : begin file r at line 11 r-r-1.tmp
 (/usr/local/teTeX/share/texmf.local/tex/context/base/pdfr-ec.tex) verbatim :
 file r-r-1.tmp.out does not exist r-r-2.tmp verbatim : file r-r-2.tmp.out
 does not exist r-r-3.tmp r-r-4.tmp verbatim : file r-r-4.tmp.out does not
 exist r-r-5.tmp verbatim : file r-r-5.tmp.out does not exist r-r.tmp
 (./r-r.tmp figures : figure ushape can not be found floatblocks : 1 placed )
 r-r-6.tmp verbatim : file r-r-6.tmp.out does not exist r-r.tmp (./r-r.tmp
 figures : figure lattice can not be found floatblocks : 2 placed ) r-r-7.tmp
 verbatim : file r-r-7.tmp.out does not exist

 ...

 ___
 ntg-context mailing list
 ntg-context@ntg.nl
 http://www.ntg.nl/mailman/listinfo/ntg-context



-- 
Johan Sandblom  N8, MRC, Karolinska sjh
t +46851776108  17176 Stockholm
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
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context