[R] Re: [S] Transfer between R and S-PLUS

John Maindonald john.maindonald at anu.edu.au
Thu Jun 22 02:02:48 CEST 2000

Mike Prager wrote -


BDR>>Oh, and the R dialect of S has different scope rules and I am not
>>convinced that does not lead to an equal number of problems, just
>>different ones.

>Interesting observation, and one that seems to imply that the road
>from S to R and back again will be a rocky one for the user.

It depends on what one is doing.  If the use of R and S-PLUS does not
go much beyond writing functions for one's own use, my experience has
been that it is pretty easy to make the transition, in both
directions.  It is necessary to be aware of a few key differences.
Some that occur to me are: 

R's handling of NA is more intuitive; x[x<1] <- y[x<1] is pretty
much a disaster in S-PLUS if x has missing values

the default parameterisation of factors in R uses contrasts with a
baseline level (`treatment' contrasts, not S-PLUS's `helmert'
contrasts which novices rightly find puzzling),

assign(.., frame=1) is often needed in S-PLUS where the structure is
anyway visible in R,

constructs such as I(x^2) are needed in R model formulae where in
S-PLUS one can get away without them.

output structures from R functions may be different from their 
S-PLUS couterparts, and one needs to check.

I have found it fairly easy to move between R and S-PLUS in the
courses that we run for graduate students.  This has turned up
a few instances where a minor S-PLUS functionality that one needs
is missing in R.  Usually it has been easy to add.  My notes
"Data Analysis and Graphics Using R" started in an S-PLUS
incarnation.  It was reasonably easy (and highly educational) to
convert across both the examples and the graphs.

John Maindonald               email : john.maindonald at anu.edu.au        
Statistical Consulting Unit,  phone : (6249)3998        
c/o CMA, SMS,                 fax   : (6249)5549  
John Dedman Mathematical Sciences Building
Australian National University
Canberra ACT 0200
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