Dear R users,

I'm begginer in  R and using Package "SP" to tried make SpatialPolygons
object from gridTopology object , I follow example of the script but got
error.

# Example
 >library(lattice)
 >grd <- GridTopology(cellcentre.**offset=c(-175,55), cellsize=c(10,10),
 >cells.dim=c(4,4))
 >SpP_grd <- as.SpatialPolygons.**GridTopology(grd)
 >plot(SpP_grd)
 >text(coordinates(SpP_grd), sapply(slot(SpP_grd, "polygons"),
function(i) slot(i, "ID")), cex=0.5)
>trdata <- data.frame(A=rep(c(1,2,3,4), each=4), B=rep(c(1,2,3,4),
each=4), row.names=sapply(slot(SpP_grd, "polygons") *
*SpPDF <- SpatialPolygonsDataFrame(SpP_**grd, trdata) *
*>spplot(SpPDF)*


Result error in below

 > trdata <- data.frame(A=rep(c(1,2,3,4), each=4), B=rep(c(1,2,3,4),
each=4), row.names=sapply(slot(SpP_grd, "polygons")
+ SpPDF <- SpatialPolygonsDataFrame(SpP_**grd, trdata)
Error: unexpected symbol in:
"trdata <- data.frame(A=rep(c(1,2,3,4), each=4), B=rep(c(1,2,3,4),
each=4), row.names=sapply(slot(SpP_grd, "polygons")
SpPDF"
 > spplot(SpPDF)
Error in spplot(SpPDF) :
   error in evaluating the argument 'obj' in selecting a method for
function 'spplot': Error: object 'SpPDF' not found


Please, any one can help me. Thank u very much


Best Regards,


Rely

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to