Using a counter inside an apply structured loop in R
I'm trying to plot from a rather complex array in R. I want to produce an image with 3 by 3 graphs, each with red and blue points on it. I've got a structure of apply loops which works, but I'd like to change the y maximum value by each row. I would normally do this using a counter, like i, in other languages. But the apply thing in R is completely baffling me! par(mfrow=c(3,3),pty="s") # a 3 by 3 graphic set.seed(1001) x <- 1:54 # with 1 to 54 along the x axis y <- array(rexp(20), dim=c(54,6,3,2)) # and the y axis coming # from an array with dimensions as shown. ymax <- c(1,0.1,0.3) # three