R-beta: Splus incompatibility in axis() and image()

Steve Cassidy steve at srsuna.shlrc.mq.edu.au
Wed Feb 25 00:14:03 CET 1998


Just a note to point out a couple of small incompatibilities that tripped up a port of 
some S code to R.  

in axis() the first argument is called 'which' in R but 'side' in Splus, so code which
names the first arg (ie axis(side=1)) falls over in R. The fix is a trivial name 
change in src/library/base/R/axis. 

in image() the defaulting of arguments doesn't allow me to say image(z) where z is a
matrix, in Splus it does.  Here's a version of src/library/base/R/image which I think 
works: 

image <-
function (x=seq(0,1,len=nrow(z)), y=seq(0,1,len=ncol(z)), z,
	zlim=range(z, na.rm=TRUE), col=heat.colors(12),
	add = FALSE, xaxs="i", yaxs="i", xlab, ylab, ...)
{
        # if only one arg, it is z
        if(missing(y) && missing(z)) {
          z <- x
          x <- seq(0,1,len=nrow(z))
          y <- seq(0,1,len=ncol(z))
          if(missing(xlab)) xlab <- ""
          if(missing(ylab)) ylab <- ""
        } else {
          if(missing(xlab)) xlab <- if(missing(x)) "" else deparse(substitute(x))
          if(missing(ylab)) ylab <- if(missing(y)) "" else deparse(substitute(y))
        }
        
	if(!add)
	  plot(0, 0, xlim=range(x,na.rm=TRUE), ylim=range(y,na.rm=TRUE),
		type="n", xaxs=xaxs, yaxs=yaxs, xlab=xlab, ylab=ylab, ...)
	.Internal(image(as.double(x),
			as.double(y),
			as.double(z),
			as.double(zlim),
			col))
}



-- 
Steve Cassidy
------------------------------------------------------------
                Speech, Hearing and Language Research Center
                     School of English Linguistics and Media
Tel: +61 2 9850 8729			Macquarie University
Fax: +61 2 9850 9199         		North Ryde,NSW, 2109
steve at srsuna.shlrc.mq.edu.au		           Australia
http://srsuna.shlrc.mq.edu.au/~steve
------------------------------------------------------------

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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