`S Programming' by W.N. Venables & B.D. Ripley ============================================== Errata and comments for the first printing (March 2000). p. vi The S-PLUS address is now http://www.insightful.com/ p. 6 l-10 In R and S-PLUS 6.1 the concept of `upper- and lower-case roman letters' is locale-dependent: it may include accented characters on some systems. In S-PLUS prior to 6.1 it was always A-Z and a-z. p. 3 The developers of S-PLUS have demerged from MathSoft and are now known as the Insightful Corporation, S-PLUS versions 6.0 and 6.1 for both Unix/Linux and Windows are current, with a common code base. The fourth (2002) edition of MASS covers both S-PLUS and R, so has no `R Complements'. p. 7 `return' is not a reserved word in R, but it should be avoided. p. 17 The precedence in R is slightly different: & and && have a higher precedence than | and ||. p. 18 Recycling rule: see also the foot of p. 27. p. 31 pmatch() is not well-documented, and the description here was true of R at the time of writing but not of the S engines. The current behaviour of pmatch(x, table) in all three engines appears to be (from trial-and-error): First exact matches of `x' are looked for in `table'. If it is found once it is considered matched. If it is found more than once the first match found is used. If duplicates.ok = F (the default) when a value in `table' is matched it is removed from consideration. Then partial matches are considered, and finally `nomatch' is returned if the process fails. One can think of duplicates.ok = F/T as ``matching without/with replacement''. Empty strings in `x' are never matched (partially or exactly). charmatch() is similar to pmatch() with `duplicates.ok = T', the differences being that it differentiates between no match and an ambiguous partial match, it does match empty strings, and it does not allow multiple exact matches. p.40 footnote: it seems that old S and R name the list, and new S does not: R documents what it does but neither S dialect does. pp. 60, 61, 64. Replace < by > in if (abs(lambda) < 0.001) y^lambda else log(y) p. 77 line-2 delete in The function NextMethod >function<. p. 81 last display, add ... as in Ttest.matrix <- function(z, ...) Ttest(z[, 1], z[, 2], ...) Ttest.list <- function(z, ...) Ttest(z[[1]], z[[2]], ...) p. 201 line 16. R CMD ... not R cmd. p. 243 A simpler way to make libSqpe.a is to apply reimp (from http://www.acc.umu.se/~anorland/gnu-win32/) to the VC++ import library Sqpe.lib. p. 246 .Random.seed <- c(1, 1:2) (Only two seeds are required.) In current R setting via set.seed would be better. R changes ========= The book was finalized when R 0.90.1 was current. There have been many changes to R since and the first non-beta release of R, 1.0.0, was on 29 Feb 2000. As R has developed, it has adopted a number of the features of S4. As from R 1.7.0 the S4 class system is available by default, although as in S-PLUS 5/6 it is not widely used. p. 8 As from R 1.7.0 all objects in R have a reported class just as in the new S engine. p. 16 (footnote 11). R no longer converts logical columns in data frames. p. 17 help(Syntax) now gives the precedence table in R, too. p. 21 identical() and is.na<- are now both in R. p. 26 (footnote 18). R has a method for as.matrix() to make a full matrix from the results of dist. p. 27 As from R 1.4.0, R has the same rule for zero-length vectors as the new S engine. p. 29 R now has colMeans, colSums, rowMeans and rowSums. p. 30 The replacement function substring<- is now also in R. p. 31 See the comments above on pmatch(), which was altered for 1.0.0. p. 34 R now has an internal lapply and so no longer uses a for() loop. (R's apply still does.) p. 48 R now has a try() function which returns the last error message. See its help page. As from 1.7.0 restart() has been removed from R in favour of try(). p. 59 Using searchpaths() gives fuller details of the search path, such as the directory from which a package was loaded. p. 59 R 1.6.0 introduced `namespaces' for the base package. From objects in a namespace the search order is slightly different: the namespace is searched before the user's workspace .GlobalEnv. This means that when searching for object from a function defined in base, it is impossible to mask the definitions of objects in the base package. As from R 1.7.0 several other packages have namespaces, and not all objects in the package are `exported', that is visible except to other objects in the package. p. 77 As from R 1.7.0, UseMethod uses the class as reported by class(), not just the class attribute. This means it dispatches to classes such as "matrix" and "numeric". However, members of the group generics, such as the binary operators, dispatch only on the class attribute, for efficiency. p. 79 In the definition of Ttest the call to data.class is no longer needed, so this function could be just Ttest <- function(z, ...) UseMethod("Ttest") p. 99 R also has a version of the S4 formal class system available in its package `methods' (from 1.4.0), and from 1.7.0 this is loaded by default. There are some small differences (for example, class "named" is not used). p. 127 As from R 1.2.0, objects are _not_ moved during garbage collection. p. 131 It is important not to mix calls to malloc/free and Calloc/Free. These may use different memory allocators (and on the Windows port they do in R >= 1.2.0). p. 136 R now has rwarn and rexit to be called from Fortran, equivalent to warning() and stop() respectively. p. 145 PROTECTed objects are no longer moved in memory. p. 151 R has a variable-sized workspace from version 1.2.0. p. 166 footnote 5. integrate() in R 1.3.0 and later is compatible with S-PLUS's. p. 181 `R modes' for other editors have been produced: see Software->Other on CRAN. p. 182 Table 8.1: R now has debugger(). p. 183 Post-mortem debugging is available in R nowadays. p. 185 R does now have dump.frames() and debugger(). From R 1.3.0 options(error=dump.frames) works, but earlier versions needed options(error=quote(dump.frames())) and that form remains more flexible. p. 200 The one-line file TITLE has been replaced by a Title: field in the DESCRIPTION file, but at present the procedure we describe still works. p. 200 It is often easiest to let `R CMD build mypkg' build the indices, possibly editing them afterwards. There needs to be an index file 00Index for the datasets in data/, and possibly also for demos. p. 201 It is often easiest to use Rcmd INSTALL and Rcmd build to install and bundle-up packages, respectively. p. 234 R for Windows has user-programmable menus and dialog boxes from version 0.99.0. Both Unix and Windows versions have a Tcl/Tk interface to build GUI elements. p. 249 Both RGui and Rterm save the history in file .Rhistory if and only if the workspace is saved, in the same way as R under Unix. p. 250 R_NSIZE and R_VSIZE are no longer used. p. 254 R under Windows has Rcmd BATCH S-PLUS changes ============== The following are changes that have been made for S-PLUS 6.x for Unix or Windows. In the interests of efficiency these versions are often stricter, so some S3 constructions no longer work. p. 6 The set of letters allowed in syntatic names is locale-dependent as from S-PLUS 6.1. p. 30 As from 6.1, the collating sequence is that of the locale. p. 31 grep behaves as the Unix version always did on all platforms, and the previous Windows behaviour is given by the function oldGrep on Windows. There is a new function regexpr.replace similar to R's (g)sub. p. 54 There is a new function sys.time() under Windows which returns a two-element vector giving the total cpu time (NA on 95/98/ME) and the elapsed time in seconds. p. 56 The Windows version will always use .data and not _Data. .Data will also work, as Windows file systems are case-insensitive. p. 79 In the definition of Ttest replace class(x) by oldClass(x). p. 133 is now included by under Windows unless NO_NEWIO is defined, so the programmer need take no action. p. 135f The is_na mode constants like DOUBLE have been renamed to e.g. S_MODE_DOUBLE. p. 149 We believe all current versions of S-PLUS do use an ISO (aka ANSI) C compiler. p. 151 memory.size() is now available on Windows (but may only work correctly on NT / 2000 / XP). p. 159 For() is implemented in S-PLUS 6.1 for Windows but very incompletely documented and fails on our example. p. 181 S-PLUS 6.x for Windows also has script windows with some formatting features. p. 187 inspect() is available in 6.x. Although we had access to a version for 5.1, it seems it was never released. Sections 8.3 and 8.4 The way on-line help is handled has changed: see our on-line complements for S-PLUS 6 for Windows. p. 205 The preferences are in directory .prefs not _Prefs in S-PLUS 6.x for Windows. p. 213 An object explorer is also used in 6.x. p. 227 The type library is now called sp6oj.tlb. p. 237 This is more-or-less accurate for S-PLUS 6.x too, which is invoked by command Splus not Splus5. PIC and optimization flags are included in 6.x. Section A.4 For the revised procedures under versions 6.x, see the on-line complements.