[R] Re: Matlab to R ?

John W. Eaton jwe at bevo.che.wisc.edu
Tue Oct 29 19:59:23 CET 2002

On  4-Oct-2002, (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk> wrote:

| For this reason I doubt that Paul Gilbert's
| 'ex' script will encourage many to migrate from matlab/octave
| to R: simple line-editing substitutions do no go far enough;
| the script is not "intelligent".
| [...]
| I would agree that a more flexible language such as 'perl' or
| 'python' or (my favourite) 'awk' should be used instead: these
| languages are capable of sophisticated parsing of input lines,
| recognising their intent, and generating appropriate output.
| I.e. the programmer can build "intelligence" into the script.

Sorry to jump in late on this.

If you want to translate Octave code to something else, you might be
able to get the best results for the least effort by using Octave
itself as a starting point because you wouldn't have to write a parser
for the Octave language yourself.  You could just use Octave's parser,
which seems more likely to be complete than anything you could quickly
cook up in Perl, Python, or AWK.  Octave has an internal interface for
walking the parse tree that can be used to emit code.  This method is
already used as a simple pretty printer that can reconstruct a text
representation of Octave code from the parse tree.  Using that code as
a starting point for emitting proper R syntax should not be too hard.
But once you do that, you will still need an appropriate run-time

If I understand the way it is supposed to work, then Duncan's ROctave
interface avoids that problem because it makes all of R and Octave
available at the same time.  If you want to do something that only R
(Octave) knows how to do, you just ask R (Octave) to do it.  It
doesn't matter whether your primary langauge is R or Octave.

So instead of having a translator, I think I'd rather have a way to
make R and Octave work together.

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 mailing list