[R] implementing a foreign system with system?
Prof Brian D Ripley
ripley at stats.ox.ac.uk
Fri Jun 2 19:43:05 CEST 2000
On Fri, 2 Jun 2000, Robert L. Sandefur wrote:
> There is a public doman geostatistics package used in the minieral
industry called GSLIB and I would like to use it from R. However it is
fortran (but portable and easy to compile on windows and linux)
and has its own file format and control file format. It seems easiest
to write an r function to dump r data to an ascii file, build a
control file in ascii; call the GSLIB program with
system("KT3D <KT3d.ctl"), read the GSLIB output back to R and
graph it or whatever. Questions:
> 1) Is this approach used elsewhere in R?
Yes, for xgobi and until recently by read.fwf.
> 2) I know system() works from windows - would the same call work
the same from linux?
I think it will work on Linux but not on Windows!
On Windows, system uses no shell. The command is passed directly to
Windows, so it launches "KT3D" with argument "<KT3d.ctl". Now, at least
using my Windows Fortran compilers, that will not get any redirection.
(Your mileage may vary.) Use shell() on Windows, or use system(, input=).
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
More information about the R-help