Re: [Rd] system() in packages

2007-04-27 Thread Prof Brian Ripley
You have missed the point completely. There is no way you can use the same command on a Unix-alike and Windows, so using system() in packages always needs to be conditionalized on OS. If you want to use a shell on Windows, use shell(): you can even use bash with it (but startup will be really sl

Re: [Rd] system() in packages

2007-04-27 Thread Gabor Grothendieck
One can use the R shell on Windows: shell("echo foo.bar | findstr foo") or an explicit call to the Windows cmd console: system("cmd /c echo foo.bar | findstr foo") On 4/27/07, Tony Plate <[EMAIL PROTECTED]> wrote: > With cygwin bash installed under Windows, one can use pipes in system(),

Re: [Rd] system() in packages

2007-04-27 Thread Tony Plate
With cygwin bash installed under Windows, one can use pipes in system(), e.g., like this: R 2.5.0 under Windows XP: > system("echo foo | sed s/foo/bar/") # this doesn't work under windows foo | sed s/foo/bar/ > # but using 'bash -c' does: > system("bash -c \"echo foo | sed s/foo/bar/\"") bar

Re: [Rd] system() in packages

2007-04-27 Thread Seth Falcon
Robin Hankin <[EMAIL PROTECTED]> writes: > My question is, how to deal with the possibility that pari/gp is not > installed? You could add a configure script to your package to detect the availability of the tools you want to rely on. On package load, you could try a simple call and determine whe

Re: [Rd] system() in packages

2007-04-27 Thread Prof Brian Ripley
The first comment is that will only work on Unix-alikes, since '|' needs a shell. So, if this is on a Unix-alike you need to establish if the program is in the path at run time and cache the result. I have no idea if this would actually work, but for example system('gp --version') might provid

[Rd] system() in packages

2007-04-27 Thread Robin Hankin
Hello Quite often I need higher precision, or larger numbers, than IEEE double precision allows. One strategy I sometimes use is to use system() to call pari/gp, which is not constrained by IEEE. [pari/gp is a GPL high-level mathematical programming language geared towards pure mathematics]