[R] Re: Matlab to R ?

Philippe Grosjean phgrosje at ulb.ac.be
Fri Oct 4 15:32:12 CEST 2002

I have the same problem: many Matlab scripts to be converted in R. Half of
functions in the PASTECS R library are translations from Matlab 4.X - 5.X
scripts. The biggest difficulty here is that the Matlab scripts/functions
were written in the context of ... Matlab, of course. And Matlab does not
uses data frames, factors, ts, etc... Also, most Matlab scripts are not
written in a way that  directly translate into the objetc/methods paradigm
(print, summary, plot, predict, etc.) that makes the force of R. Finally,
the S language is much more powerful on subsetting matrices, and sometimes,
3 to 6 code lines in Matlab can be elegantly rewritten in one line of code
in S language. However, some Matlab 6.X (release 12 or more) scripts
translated in S language run much slower in R!

So, according to all these remarks, shouldn't it be more interesting to
develop an interface for calling a Matlab/Octave script from within R? If it
is an Octave script, we stay in the GNU licence world, so, there is no


Philippe Grosjean

( ( ( ( (
 ) ) ) ) )      Philippe Grosjean
( ( ( ( (
 ) ) ) ) )      IFREMER Nantes - DEL/AO
( ( ( ( (       rue de l'Ile d'Yeu, BP 21105, 44311 Nantes Cedex 3
 ) ) ) ) )      tel: (33), fax: (33)
( ( ( ( ( 
 ) ) ) ) )      SciViews project coordinator (http://www.sciviews.org)
( ( ( ( (       e-mail: phgrosjean at sciviews.org
 ) ) ) ) ) 
( ( ( ( (       "I'm 100% confident that p is between 0 and 1"
 ) ) ) ) )                                L. Gonick & W. Smith (1993)

>>>>> "Robin" == Robin Hankin <r.hankin at auckland.ac.nz>
>>>>>     on Fri, 4 Oct 2002 08:51:23 +1200 writes:

    Robin> Hello Michel a good place to start would be
    Robin> R-and-octave.txt, on the contributed section of CRAN
    Robin> (Octave is the free version of Matlab).

    Robin> This shows how common Matlab idioms translate to R.

and I assume you have seen Paul Gilbert's reply, giving "ex"
translations of a few idioms.

    Robin> There seem to be more and more people interested in
    Robin> porting from Matlab/octave to R.  How about a
    Robin> specialist mailing list?

I think a few interested people should "sit together" (in cyberspace)
and try to improve on the current state.
I've included John Eaton, the author of GNU octave (the free
matlab `substitute'), because he certainly knows more about the
matlab "syntax" than any of us (and Kurt who once new a lot
about octave).

Probably everyone agrees that a Matlab -> R translation cannot
(and probably should not) be automated to full extent.  On the
other hand, Paul Gilbert's "ex" script should be made into a
perl or python {or "octave" !?} script and could be enhanced
considerably, probably.

It could help matlab/octave users switch to R.
Another reason I'm interested to some extent is the
Statistics+Matlab community & software ("Wavelets", "Smoothers" etc)
where I would like us to get better connected to.

    Robin> How about a specialist mailing list?

Not sure if this is needed and makes sense;  I have already set up a dozen
R-SIG-* (R Special Interest Group in ****) mailing lists and
only a few are somewhat active.
But then it may make sense for a short time?

    MichelA> I have a matlab program. I would like to transfer code in
    MichelA> R. Is there any translator ?  Thanks for your help

Martin Maechler <maechler at stat.math.ethz.ch>	http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum  LEO C16	Leonhardstr. 27
ETH (Federal Inst. Technology)	8092 Zurich	SWITZERLAND
phone: x-41-1-632-3408		fax: ...-1228			<><
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

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