[R-sig-Geo] daily precipitation idw & kriging and beginner questions
Tom Gottfried
tom.gottfried at wzw.tum.de
Sat Aug 22 00:13:40 CEST 2009
Hi Ivan,
> What should foo.plotting look like?
What I thought to do in foo.plotting was what Edzer suggested but on
the corresponding elements in jan2000_idw and jan2000_kri:
foo.plotting <- function(idw, kri) {
...
Pd.idw$idw = idw$var1.pred
Pd.idw$ok = kri$krige_output$var1.pred
print(spplot(Pd.idw, c("idw", "ok")))
dev.copy(.....); dev.off()
}
dummy <- mapply(foo.plotting, jan2000_idw, jan2000_kri)
This should give you one jpeg or whatever file per day, each with one
plot showing two maps (one for idw, the other for kriging). I think
this is already more handy than having every single map in one file,
but not as handy as having them all on one plot (as Edzer suggested
in his mail this afternoon).
Remark: spplot and other lattice plots are not plotted automatically
from within loops or functions! You have to do that explicitly with
print().
> And what does plots look like? Is it a list with jpg's?
Plotting is done with print() in foo.plotting(). dev.copy() copies
the plot to an other device, e.g. a jpeg-file. However the return
value of foo.plotting() is not a jpeg but the return value of dev.off
(), as a function always returns what is lastly evaluated. Unless you
call return() explicitly. Thus dummy in the above "code" won't be a
list of jpegs but of return values of dev.off(), which might not be
very useful for you as you are interested in the graphics output
which is produced before foo.plotting() gives back a return value.
Hope this helps!
Tom
More information about the R-sig-Geo
mailing list