R-alpha: some minor inconsistencies

Bill Venables (wvenable@attunga.stats.adelaide.edu.au)
Sat, 29 Mar 1997 13:39:44 +1030

Date: Sat, 29 Mar 1997 13:39:44 +1030
Message-Id: <9703290309.AA24871@attunga.stats.adelaide.edu.au>
From: Bill Venables <wvenable@attunga.stats.adelaide.edu.au>
To: r-testers@stat.math.ethz.ch
Subject: R-alpha: some minor inconsistencies

While transferring some old S-code I came across some minor
inconsistencies between R and S that are probably more nuisance
value than they would take to fix.  I report them here for
reference, (but not in any campaigning mood, of course...)

1. No frame() command in R and so no graceful way to clear a
   plotting screen.  (Or is there?)

2. There is a dev.off() function, but no other dev.xxx functions.
   (The dev.xxx group are S-PLUS and not vanilla S, by the way.)
   There is no graphics.off() function.

3. If dfr is a data frame with components "x", "y" and some
   others then points(dfr) uses dfr as an xy-list in S but not in
   R.  If there is some non-numeric component it actually fails
   in R.  This may be S being a bit inconsistent, but the
   behaviour is different.

4. The plotting marks are a bit gappy in R and even the ones
   that are there do not correspond to their S counterparts.
   Here is a little function to make a wall chart showing the
show.marks <- function()
  if(!exists(".Device") || is.null(.Device)) x11()
  plot(1, type="n", axes=F, xlab="", ylab="")
  oldpar <- par()
  par(usr = c(-0.01, 5.01, -0.01, 5.01), pty = "s")
  for(i in 0:18) {
    x <- 1/2 + (i %% 5)
    y <- 4.5 - (1/2 + (i %/% 5))
    points(x + 1/5, y - 1/5, pch = i, cex = 3)
    text(x - 1/5, y + 1/5, i, adj = 0.5, cex = 1.5)
  abline(h = 1:5 - 0.5, lty = 1)
  segments(0:5, rep(0.5, 5), 0:5, rep(4.5, 5))

5. In S you may extend a list by assigning to a new component.
   For example if lis has components "x" and "y", only, you can
   extend it by assigning to lis$z, lis["z"] or lis[, "z] (the
   last if it is also a data frame).  In R only the first of
   these works; the others give a "subscript out of bounds"
   error.  (This may have been discussed while I was not paying
   attention, in which case I apologize.)

Bill Venables.
Bill Venables, Head, Dept of Statistics,    Tel.: +61 8 8303 5418
University of Adelaide,                     Fax.: +61 8 8303 3696
South AUSTRALIA.     5005.   Email: Bill.Venables@adelaide.edu.au
r-testers 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-testers-request@stat.math.ethz.ch