R-beta: image S vs. R compatibility

Zivan Karaman (zk@biocem.univ-bpclermont.fr)
Fri, 27 Mar 1998 09:38:17 +0100

Message-Id: <>
Date: Fri, 27 Mar 1998 09:38:17 +0100
To: r-help <r-help@stat.math.ethz.ch>
From: zk@biocem.univ-bpclermont.fr (Zivan Karaman)
Subject: R-beta: image S vs. R compatibility


First of all I would like to thank very much Guido Masarotto for the latest
Win32 version of R. I've installed it painlessly on WinNT 4 Workstation,
and it is loading and running fast. The only problems I've had thus far are
demos 6 to 8 ("recursion", "scoping", and "is.things"), which cause a
memory protection fault.

I've a question regarding the image function, which I use frequently and
for various purposes. Apparently, the S and the R version of the image
function don't behave the same way. I've attached below a function that
under S produces chessboard-like figures, while it produces irregular
pattern with R (never mind different colours in R and S, this is not a
point). Does anybody know how can one obtain the chessboard images (squares
or rectangles of the same size) with R?

Best regards


test.image <- function(n)
	if(n < 2)
		stop("n must be >= 2")
	pause <- function(msg = 
		"Press <ENTER> to continue...")
	for(i in 2:n) {
		i1 <- i + 1
		i2 <- i * i
		image(x = 1:i1, y = 1:i1, z = matrix(
			1:i2, ncol = i))

Zivan Karaman
Limagrain Genetics Research, B.P. 115, 63203 Riom Cedex, France
Tel: +33 (0) 473 634 343     Fax: +33 (0) 473 634 345
E-mail: zivan.karaman@biocem.univ-bpclermont.fr
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@stat.math.ethz.ch