Hello all - I've just recently been exploring R for the first time. After noticing a few things that have changed from S to R, I started looking for an R-S compatibility table but didn't find it. Is such a table out there ? Where ? Thanks much, Purvis Bedenbaugh purvis at mbi.ufl.edu Examples: 'stdev' is now 'sd' - is it exactly the same computation ? couldn't find a built-in for error.bar() syntax that is an error in R: param(thisframe,"b") <- value> version_ platform mips-sgi-irix6.5 arch mips os irix6.5 system mips, irix6.5 status major 1 minor 8.0 year 2003 month 10 day 08 language R>
One comment: the first two of those are not in S, but rather in S-PLUS. So a big question is compatibility with what? (There are quite large compatibility differences between versions of S-PLUS too.) There are comments on differences in the FAQ, but they are not comprehensive. On Mon, 20 Oct 2003, Purvis Bedenbaugh wrote:> Hello all - I've just recently been exploring R for the > first time. After noticing a few things that have changed > from S to R, I started looking for an R-S compatibility table > but didn't find it. Is such a table out there ? Where ? > > Thanks much, > > Purvis Bedenbaugh > purvis at mbi.ufl.edu > > Examples: > > 'stdev' is now 'sd' - is it exactly the same computation ? > couldn't find a built-in for error.bar() > syntax that is an error in R: param(thisframe,"b") <- value-- 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 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
>>>>> "Purvis" == Purvis Bedenbaugh <purvis at mbi.ufl.edu> >>>>> on Mon, 20 Oct 2003 08:03:13 -0400 writes:Purvis> Hello all - I've just recently been exploring R for Purvis> the first time. After noticing a few things that Purvis> have changed from S to R, I started looking for an Purvis> R-S compatibility table but didn't find it. Is such Purvis> a table out there ? Where ? Purvis> Thanks much, Purvis> Purvis Bedenbaugh purvis at mbi.ufl.edu Purvis> Examples: Purvis> 'stdev' is now 'sd' "now" is good. sd() has been in R for about 7 years, whereas stdev() was introduced into S+ only for version 6.x.. in about 2000. Purvis> - is it exactly the same computation ? no, it isn't (in more than one sense)... Purvis> couldn't find a built-in for error.bar() "built-in" is not a good notion in any version of S, but much less in R : R comes with 28 (standard + recommended) packages of which only a few are attached by default, and CRAN has over 200 contributed packages; Bioconductor has another several dozen, and there are more outside the official repositories above. Several of the CRAN packages have error.bar incantations.. Purvis> syntax that is an error in R: param(thisframe,"b") <- value It's not a syntax error; just, there's no "param<-" function in the currently attached R packages (and not in other R packages I seem to have around)... Prof. Brian Ripley has given you more hints already. -- 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 <><
Purvis Bedenbaugh <purvis at mbi.ufl.edu> wrote:> I started looking for an R-S compatibility table but didn't find it. > Examples: > 'stdev' is now 'sd' - is it exactly the same computation ? > couldn't find a built-in for error.bar() > syntax that is an error in R: param(thisframe,"b") <- valueIt's a moving target! I wrote such a list in October 2001, and revised it a year later, but I haven't updated it since then (I no longer use S-Plus). Some people (e.g. Paul Gilbert) replied that they also had lists which didn't overlap much with mine, suggesting we were each seeing just a small part of the puzzle. So maintaining a complete and current list would be quite a challenge. Paul also mentioned to me a mailing list "R-sig-S" on the topic: <https://www.stat.math.ethz.ch/mailman/listinfo/r-sig-s> but it seems dead since May 2001. That said, here's my year-old list. Note "S" means "S-Plus 6.1.2" (not "The S Language") and "R" probably means "R-1.6.0". *** R vs. S (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. 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. - for() loops more efficient in R. Graphics differences: - Log scale indicated in S 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: - strsplit, sub, gsub, chartr, formatC Functions that work differently: - system() has no "input" argument in R. - substring(s,"x") <- "X" only works in S, but R has s <- gsub("x","X",s). - scan expects numbers by default in R. - which(<numeric>) converts to logical in S, is an error in R. - The NULL returned by if(F){...} is invisible in R, visible in S. - The NULL returned by return() is visible in R, invisible in S. - Args to "var" differ, and R has "cov". S na.method="a" ~ R use="p". - var (or cov) drops dimensions in S, not R. - cut allows labels=F in R, not in S (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. - probability distribution fcn's have arg "log.x" in R (ref: Spencer Graves) -- -- David Brahm (brahm at alum.mit.edu)