[R-sig-Geo] (no subject)

Roger Bivand Roger.Bivand at nhh.no
Thu Sep 28 15:26:55 CEST 2006


On Thu, 28 Sep 2006, Roger Bivand wrote:

> On Thu, 28 Sep 2006, pir2.jv wrote:
> 
> > 
> > Le 28 sept. 06 à 13:09, Roger Bivand a écrit :
> > 
> > >
> > > OK, the file size at least looks correct, and the output of the  
> > > summary
> > > looks good too. 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?
> 
> > >
> > > 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)
> 
> you should see:
> 
> [1] "SpatialPolygonsDataFrame" "SpatialPolygons"         
> [3] "Spatial"  
> 
> and method dispatch should choose plot.SpatialPolygons - can you try
> 
> plot.SpatialPolygons(xx, axes=TRUE)

Sorry, that should have been:

sp:::plot.SpatialPolygons(xx, axes=TRUE)

not as above.

> 
> directly. I'm fairly certain that the method dispatch of plot is getting 
> interfered with, since the class of xx is OK.
> 
> Roger
> 
> 
> > > ===============
> > 
> > 
> > If, I put:
> >  > Xlim
> > [1] -84 -75
> > 
> >  > Ylim
> > [1] 33 37
> >  > plot(xx,axes=TRUE,xlim=Xlim,ylim=Ylim)
> > 
> > give an empty image
> > ========================
> > But;
> > spplot(xx,axes=TRUE) seems to product the good image.
> > 
> > 
> > 
> > Thanks
> > 
> > > Roger
> > >
> > >>
> > >>> load("/Users/jver/Desktop/HMP/.RData")
> > >>> library(maptools)
> > >> Le chargement a nécessité le package : foreign
> > >> Le chargement a nécessité le package : sp
> > >>
> > >>> sessionInfo()
> > >> Version 2.3.1 (2006-06-01)
> > >> powerpc-apple-darwin8.6.0
> > >>
> > >> attached base packages:
> > >> [1] "methods"   "stats"     "graphics"  "grDevices" "utils"
> > >> "datasets"
> > >> [7] "base"
> > >>
> > >> other attached packages:
> > >> maptools       sp  foreign
> > >> "0.5-15" "0.8-20" "0.8-15"
> > >>
> > >>> fn <- system.file("shapes/sids.shp", package="maptools")[1]
> > >>> str(fn)
> > >> chr "/Library/Frameworks/R.framework/Versions/2.3/Resources/library/
> > >> maptools/shapes/sids.shp"
> > >>
> > >>
> > >>> file.info(fn)
> > >>
> > >>                    size
> > >> /Library/Frameworks/R.framework/Versions/2.3/Resources/library/
> > >> maptools/shapes/sids.shp 46196
> > >>
> > >>                   isdir
> > >> /Library/Frameworks/R.framework/Versions/2.3/Resources/library/
> > >> maptools/shapes/sids.shp FALSE
> > >>
> > >>                   mode
> > >> /Library/Frameworks/R.framework/Versions/2.3/Resources/library/
> > >> maptools/shapes/sids.shp  644
> > >>
> > >>                                 mtime
> > >> /Library/Frameworks/R.framework/Versions/2.3/Resources/library/
> > >> maptools/shapes/sids.shp 2006-09-23 10:15:57
> > >>
> > >>                                 ctime
> > >> /Library/Frameworks/R.framework/Versions/2.3/Resources/library/
> > >> maptools/shapes/sids.shp 2006-09-28 11:39:39
> > >>
> > >>                                 atime
> > >> /Library/Frameworks/R.framework/Versions/2.3/Resources/library/
> > >> maptools/shapes/sids.shp 2006-09-28 11:39:39
> > >>
> > >>                   uid
> > >> /Library/Frameworks/R.framework/Versions/2.3/Resources/library/
> > >> maptools/shapes/sids.shp 501
> > >>
> > >>                   gid
> > >> /Library/Frameworks/R.framework/Versions/2.3/Resources/library/
> > >> maptools/shapes/sids.shp  80
> > >>
> > >>                   uname
> > >> /Library/Frameworks/R.framework/Versions/2.3/Resources/library/
> > >> maptools/shapes/sids.shp  jver
> > >>
> > >>                   grname
> > >> /Library/Frameworks/R.framework/Versions/2.3/Resources/library/
> > >> maptools/shapes/sids.shp  admin
> > >>
> > >>> xx <- readShapePoly(fn, proj4string=CRS("+proj=longlat
> > >> +ellps=clrk66"))
> > >>> class(xx)
> > >> [1] "SpatialPolygonsDataFrame"
> > >> attr(,"package")
> > >> [1] "sp"
> > >>> bbox(xx)
> > >>           min       max
> > >> r1 -84.32385 -75.45698
> > >> r2  33.88199  36.58965
> > >>> summary(xx)
> > >> Object of class SpatialPolygonsDataFrame
> > >> Coordinates:
> > >>           min       max
> > >> r1 -84.32385 -75.45698
> > >> r2  33.88199  36.58965
> > >> Is projected: FALSE
> > >> proj4string : [+proj=longlat +ellps=clrk66]
> > >> Data attributes:
> > >>        AREA          PERIMETER         CNTY_
> > >> CNTY_ID            NAME
> > >> Min.   :0.0420   Min.   :0.999   Min.   :1825   Min.   :1825
> > >> Alamance : 1
> > >> 1st Qu.:0.0910   1st Qu.:1.324   1st Qu.:1902   1st Qu.:1902
> > >> Alexander: 1
> > >> Median :0.1205   Median :1.609   Median :1982   Median :1982
> > >> Alleghany: 1
> > >> Mean   :0.1263   Mean   :1.673   Mean   :1986   Mean   :1986
> > >> Anson    : 1
> > >> 3rd Qu.:0.1542   3rd Qu.:1.859   3rd Qu.:2067   3rd Qu.:2067
> > >> Ashe     : 1
> > >> Max.   :0.2410   Max.   :3.640   Max.   :2241   Max.   :2241
> > >> Avery    : 1
> > >>
> > >> (Other)  :94
> > >>        FIPS        FIPSNO         CRESS_ID          BIR74
> > >> SID74
> > >> 37001  : 1   Min.   :37001   Min.   :  1.00   Min.   :  248
> > >> Min.   : 0.00
> > >> 37003  : 1   1st Qu.:37050   1st Qu.: 25.75   1st Qu.: 1077   1st
> > >> Qu.: 2.00
> > >> 37005  : 1   Median :37100   Median : 50.50   Median : 2180
> > >> Median : 4.00
> > >> 37007  : 1   Mean   :37100   Mean   : 50.50   Mean   : 3300
> > >> Mean   : 6.67
> > >> 37009  : 1   3rd Qu.:37150   3rd Qu.: 75.25   3rd Qu.: 3936   3rd
> > >> Qu.: 8.25
> > >> 37011  : 1   Max.   :37199   Max.   :100.00   Max.   :21588    
> > >> Max.   :
> > >> 44.00
> > >> (Other):94
> > >>      NWBIR74           BIR79           SID79          NWBIR79
> > >> Min.   :   1.0   Min.   :  319   Min.   : 0.00   Min.   :    3.0
> > >> 1st Qu.: 190.0   1st Qu.: 1336   1st Qu.: 2.00   1st Qu.:  250.5
> > >> Median : 697.5   Median : 2636   Median : 5.00   Median :  874.5
> > >> Mean   :1050.8   Mean   : 4224   Mean   : 8.36   Mean   : 1352.8
> > >> 3rd Qu.:1168.5   3rd Qu.: 4889   3rd Qu.:10.25   3rd Qu.: 1406.8
> > >> Max.   :8027.0   Max.   :30757   Max.   :57.00   Max.   :11631.0
> > >>
> > >>>
> > >
> > 
> > Jacques Vernin
> > 
> > 
> > 
> 
> 

-- 
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




More information about the R-sig-Geo mailing list