[R] R v/s S-plus

David Brahm brahm at alum.mit.edu
Tue Oct 29 00:20:26 CET 2002


Saket Joshi <joshi at engr.orst.edu> wrote:
> I have Splus and R both on my unix machine. I intend to keep only one...
> Is there any function or group of functions in Splus that are absent in R?

I'm attaching my personal list of differences (which has shrunk considerably
since I posted it here a year ago).  Big picture, the most significant ones
(scoping rules, graphics model, for-loop efficiency) favor R in my opinion.

Please see <http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html> ("R and S") also.

A very nice feature of R is that users can contribute new features or bug fixes
by submitting packages to CRAN or lobbying the R Core team, and all underlying
C code is visible to the user.  Also, questions sent to R-help are immediately
tackled by several very brilliant (if sometimes ornery) experts, whereas
Insightful's technical support (in my experience) can be polite but useless.

S-Plus does have a fancier GUI (but I don't use it).

I think the value added by Insightful is mainly in their ongoing efforts to
build proprietary modules (FinMetrics, NuOpt), external interfaces (Excel,
financial data), and tools that encompass/extend S-Plus (Insightful Miner,
StatServer).  In other words, they do offer a broader product range.


                     ***   R vs. S-Plus (DB 10/28/02)  ***

Language differences:
- Scoping rules differ.  In R, functions see the functions they're in.  Try:
    f1 <- function() {x <- 1; f2 <- function() print(x); f2()};  f1()
- Data must be loaded explicitly in R, can be attach()'ed in S-Plus.
    Addressed by my contributed package "g.data".
- R has a character-type NA, so LETTERS[c(NA,2)] = c(NA,"B") not c("","B")
- paste("a","b", sep="|", sep=".") is an error in R; ok in S-Plus.
- for() loops more efficient in R.

Graphics differences:
- Log scale indicated in S-Plus with par(xaxt)=="l", in R with par("xlog")==T.
- R has cex.main, col.lab, font.axis, etc.  Thus title("Hi", cex=4) fails.
- R has plotmath and Hershey vector fonts.
- R has palette(rainbow(10)) to define colors (both screen and printer).

Functions missing from R:
- unpaste, slice.index, colVars

Functions missing from S-Plus:
- strsplit, sub, gsub, chartr, formatC

Functions that work differently:
- system() has no "input" argument in R.
- substring(s,"x") <- "X" only works in S-Plus, but R has s <- gsub("x","X",s).
- scan expects numbers by default in R.
- which(<numeric>) converts to logical in S-Plus, is an error in R.
- The NULL returned by if(F){...} is invisible in R, visible in S-Plus.
- The NULL returned by return() is visible in R, invisible in S-Plus.
- Args to "var" differ, and R has "cov".  S-Plus na.method="a" ~ R use="p".
- var (or cov) drops dimensions in S-Plus, not R.
- cut allows labels=F in R, not S-Plus (also left.include=T becomes right=F).
- Last argument of a replacement function must be named "value" in R.
- tapply(1:3, c("a","b","a"), sum) is a 1D-array in R, a vector in S-Plus.

-- 
                              -- David Brahm (brahm at alum.mit.edu)
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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