[R-sig-Geo] (no subject)
Roger.Bivand at nhh.no
Thu Sep 28 16:18:47 CEST 2006
On Thu, 28 Sep 2006, pir2.jv wrote:
> Le 28 sept. 06 à 15:06, Roger Bivand a écrit :
> >>> By the way, why the load()?
> >> The load is the system response when I click the R.data in the
> >> project directory
> > I think that this is the problem, and that you have an alternative
> > local
> > copy of plot that disturbs the method dispatch.
> > If you say ls(), do the names of any of the objects begin with plot?
> > ls(pat="plot")
>  "BBplot" "Bplot" "draw.plotmath.cell"
>  "plot" "plotG" "plotM"
>  "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
> >>> Could you now try plot(xx, axes=TRUE), and then traceback()
> >>> immediately
> >>> after the error occurs?
> >>> plot(xx,axes=TRUE)
> >> Erreur dans plot.window(xlim, ylim, log, asp, ...) :
> >> 'xlim' nécessite des valeurs finies
> >> De plus : Warning messages:
> >> 1: aucun argument trouvé pour min ; Inf est renvoyé
> >> 2: aucun argument pour max ; -Inf est renvoyé
> >> 3: aucun argument trouvé pour min ; Inf est renvoyé
> >> 4: aucun argument pour max ; -Inf est renvoyé
> >>> traceback()
> >> 4: plot.window(...)
> >> 3: localWindow(xlim, ylim, log, asp, ...)
> >> 2: plot.default(xx, axes = TRUE)
> >> 1: plot(xx, axes = TRUE)
> > This is where it is going wrong. If you do:
> > is(xx)
> > is(xx)
>  "SpatialPolygonsDataFrame" "SpatialPolygons"
>  "Spatial"
> seems to be good
> > you should see:
> >  "SpatialPolygonsDataFrame" "SpatialPolygons"
> >  "Spatial"
> > and method dispatch should choose plot.SpatialPolygons - can you try
> > plot.SpatialPolygons(xx, axes=TRUE)
> > directly.
> sp:::plot.SpatialPolygons(xx, axes=TRUE)
> give a map which seems to be good one !!!
> (but I had removed the plot* as below before this instruction)
> > I'm fairly certain that the method dispatch of plot is getting
> > interfered with, since the class of xx is OK.
> Jacques Vernin
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
More information about the R-sig-Geo