R-beta: S compatibility

Prof Brian D Ripley ripley at stats.ox.ac.uk
Sun Aug 16 10:08:56 CEST 1998


>From Martin Maechler (maechler at stat.math.ethz.ch)

> >>>>> "Jim" == Jim Lindsey <jlindsey at alpha.luc.ac.be> writes:
> 
> Jim> Once again, I foolishly attempted a major port of S, ratfor, and
> Jim> Fortran code (hidden Markov models from an article in the latest Can
> Jim> Jr Stat) to R without access to S-Plus itself. Here are some 
problems
> Jim> I found before abandoning:
> 
> Jim> 2. sample() does not have the option, prob=
> yes. Volunteers to add it ?

Look at my port of the boot package on CRAN, in zzz.R. One day
I will internalize this for efficiency.

> Jim> 3. glm()$assign does not exist
> yes. Volunteers to add it ? [the same for lm()$assign]

But the structure of assign is very different between S and R,
and of course is undocumented under R. In retrospect it would have
been more efficient to alter R to be compatible before trying to
write aov. But to do that I would have had to know what the differences
were ....

> Jim> 4. glm()$contrast is very different from S - apparently the latter
is
> Jim> a list with one member per variable instead of a copy of the
options
> Jim> in effect
> The next (0.63) version of R will have the same as S, here (I think).
> 
> WARNING: The current snapshot of 0.63 is currently somewhat ``more
> unstable'' than usual.

It is in 0.62.3 now. But there are some incompatibilities at this level,
as in S the contrasts are numeric and in R they can be functions.
I believe all the internal code copes with this, but user-written 
code might not. This is an attempt to be backwards compatible with
both R and S.

> Jim> 5. C() does not exist (something to do with contrasts, which are
> Jim> apparently handled much differently in S-Plus)

It does not exist, but as of 0.62.3 the differences in handling are minor.

> Jim> 6. dummy.coef() does not exist
> Yes.
> Brian Ripley's aov package which should also make it's way into R 0.63,
> has model.tables() which provides even more than dummy.coef..
> 
> Any volunteers (maybe after 0.63) for doing
> 
> C() [maybe not so easy]
> dummy.coef [should be easy/trivial, if you have model.tables]

Actually, dummy.coef in its full glory is not at all easy, as far as I can
see.  These are used rarely, and there is always (so far)  another,
cleaner, way to do it (for C used contrasts<-: that does now work
compatibly).  It seems dummy.coef may not be in future versions of S. 


As someone who has spent far too many hours trying to port S(-PLUS) code to
R, I am not at all surprised. I am also not sympathetic. If you have S-PLUS
code and your time has value (Jim's must: look at all those books), go buy
a copy of S-PLUS (and a machine if necessary) to run it on. The point for
me at least of porting code to R is purely altruistic: it makes it more
widely available, particularly to the student community (or it will when
the Windows versions of R catch up). 

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