Hi!

I am a beginner on R, especially on programming. I'm trying to produce 
several maps by page with the bubble function of the sp package. But I 
encounter some difficulties to customize the bubble function.

I saw that classic function like par(mfrow=) or layout() don't work with 
lattice graphics. So, I used the split parameter to define the position 
of each map. But as I working on many variables, this solution isn't 
really convenient. After some research, it seems that I should use the 
panel function inside the bubble one. But my attempts failed with an 
error like the "argument matches multiple formal arguments".

I use the meuse dataset as example of my scheme. I show you my script, 
maybe it could help to find where I'm wrong.

|library(sp)
library(lattice)
data(meuse)
coordinates(meuse) <- ~x+y
test<-meuse[,1:4]

for (i in 1:4)
{ carte<-bubble(test,zcol=i,fill=TRUE,maxsize=2,do.sqrt=TRUE,col=2)
}

plot(carte, index.cond = list(rep(1,4)),
      layout = c(2, 2),
      panel = function(x, y, ...)
      {
         panel.bubble(x,y,...)
})|

|# This gives the error:| |Error in plot.trellis(carte, index.cond = 
list(rep(1, 4)), layout = c(2,  : argument 4 matches multiple formal 
arguments|

So the panel function don't works well in my script, but I don't 
understand why (I also try to change panel.bubble by panel.plot, without 
effects).

As I said before, my dataset contains many variables. So I add new 
variables to the meuse dataset to have a more relevant dataset for my 
problem.

|meuse1<-meuse[,1:6]
meuse1$ion1<-meuse1$cadmium
meuse1$ion2<-meuse1$copper
meuse1$ion3<-meuse1$lead
meuse1$ion4<-meuse1$zinc
meuse1$ion5<-meuse1$cadmium
meuse1$ion6<-meuse1$copper
meuse1$ion7<-meuse1$lead
meuse1$ion8<-meuse1$zinc
meuse1$ion9<-meuse1$cadmium
meuse1$ion10<-meuse1$copper
meuse1$ion11<-meuse1$lead
meuse1$ion12<-meuse1$zinc
coordinates(meuse1) <- ~x+y
test2<-meuse1[,1:16]|

I desire to create my maps with the bubble function, with a presentation 
of six maps by page (3 lines and 2 columns). I tried to read the code of 
the bubble function but I'm not able to understand what are doing the 
different lines. Do you know where I could found explanations of the 
bubble code? Or if you have any idea to improve my script, I'll be grateful.

Any direction (or any documentation where I could find something to go 
ahead) would be welcome.

-- 
Gaspard Charrier
Ingénieur d'études
GEOLAB - UMR 6042


	[[alternative HTML version deleted]]

