(no subject)
On Thu, 28 Sep 2006, Frank Hardisty wrote:
Dear Jacques Vernin (and All), I appreciate that you are experiencing some difficulties when using R and spatial extensions. However, please realize that Roger Bivand has been wonderfully patient and helpful to many, many people, as you can see in the history of this email list. Please remember that R and R spatial extensions are written, maintained, and supported by volunteer labor.
Thanks for your kind words, Frank! But in fact at least one of my replies to Jacques was brusque, I can get annoyed when people do not follow general R list advice and state their platform and package versions. So his choice of tone is partly my choice. The resolution here is that overloading existing functions is *not a good idea* and can lead to unexpected consequences, like this method dispatching muddle. Using the package framework and guarding the local code in a namespace should solve it. Roger PS. I had a very interesting talk at FOSS4G with someone attacking the spatial R/Java puzzle through JRI (see the rJava package), who reported much more success than we had two years ago.
Your email "tone of voice" is not very sweet, considering that you are asking for free help. regards, -Frank Hardisty ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Frank Hardisty Department of Geography University of South Carolina hardisty at sc.edu Office -- 803-777-5729 Fax -- 803-777-4972 http://people.cas.sc.edu/hardistf/ On 9/28/06, Frank Hardisty <HardistF at gwm.sc.edu> wrote:
---------- Forwarded message ---------- From: "pir2.jv" <pir2.jv at wanadoo.fr> To: Roger.Bivand at nhh.no Date: Thu, 28 Sep 2006 16:42:13 +0200 Subject: Re: [R-sig-Geo] (no subject) Le 28 sept. 06 ? 16:18, Roger Bivand a ?crit :
If you say ls(), do the names of any of the objects begin with plot?
ls(pat="plot")
[1] "BBplot" "Bplot" "draw.plotmath.cell" [4] "plot" "plotG" "plotM" [7] "plotx" "plotxx" plotx, plotxx, plotG and plotM are functions of mine. Is there a problem ?
The problem is that your local function plot is masking the one which understands that "SpatialPolygons" objects have their own method and need to be sent there, so yes, at least your local plot is the problem. The standard advice if you have a number of functions is to write a package with a NAMESPACE, and that will protect you from R not choosing the one you intended.
Why would be my function plot local ? It is not. I removed the others ============
> plot
function (x, y, ...)
{
if (is.null(attr(x, "class")) && is.function(x)) {
nms <- names(list(...))
if (missing(y))
y <- {
if (!"from" %in% nms)
0
else if (!"to" %in% nms)
1
else if (!"xlim" %in% nms)
NULL
}
if ("ylab" %in% nms)
plot.function(x, y, ...)
else plot.function(x, y, ylab = paste(deparse(substitute(x)),
"(x)"), ...)
}
else UseMethod("plot")
}
<environment: namespace:graphics>
=============================
Jacques Vernin
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: Roger.Bivand at nhh.no