[R-sig-Geo] plotting Polygon (sp)
Sebastian P. Luque
spluque at gmail.com
Wed Jun 9 01:26:23 CEST 2010
Hi,
Using the example from the vignette "sp" (section 7.1):
---<--------------------cut here---------------start------------------->---
R> sr1
An object of class "Polygon"
Slot "labpt":
[1] 2.697 3.545
Slot "area":
[1] 5.5
Slot "hole":
[1] TRUE
Slot "ringDir":
[1] -1
Slot "coords":
[,1] [,2]
[1,] 2 2
[2,] 4 3
[3,] 4 5
[4,] 1 4
[5,] 2 2
R> plot(sr1)
Error in as.double(y) :
cannot coerce type 'S4' to vector of type 'double'
R> showMethods("plot")
Function: plot (package graphics)
x="ANY", y="ANY"
x="Polygon", y="missing"
(inherited from: x="ANY", y="ANY")
x="SpatialLines", y="missing"
x="Spatial", y="missing"
x="SpatialPoints", y="missing"
x="SpatialPolygons", y="missing"
R> sessionInfo()
R version 2.11.1 (2010-05-31)
x86_64-pc-linux-gnu
locale:
[1] LC_CTYPE=en_CA.UTF-8 LC_NUMERIC=C LC_TIME=en_CA.UTF-8
[4] LC_COLLATE=en_CA.UTF-8 LC_MONETARY=C LC_MESSAGES=en_CA.UTF-8
[7] LC_PAPER=en_CA.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_CA.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rgdal_0.6-27 maptools_0.7-34 foreign_0.8-40 mapdata_2.1-2 maps_2.1-3
[6] sp_0.9-64 slmisc_0.7.6 lattice_0.18-8
loaded via a namespace (and not attached):
[1] grid_2.11.1 tools_2.11.1
---<--------------------cut here---------------end--------------------->---
Why is plot() failing with that error?
Cheers,
--
Seb
More information about the R-sig-Geo
mailing list