[R-sig-Geo] Error in sample package SP

Alexandre Villers villers.alexandre at gmail.com
Mon Feb 4 13:06:18 CET 2013


Good afternoon,

You should be more specific when reporting an error if you want people 
to help you. Check this link first 
http://www.r-project.org/posting-guide.html
- Stating "Result error in below" is not really the best sentence to 
attract one's attention. What is the problem exactly?
- You could also try to provide us with a reproducible example that can 
be sent straightforwardly to R (withtout needing to, e.g., remove the 
'>' at the beginning of each line)
- State where exactly you got the example from
  -Report the sessionInfo()
etc...

HTH

Alex


On 04/02/2013 13:19, Rely Al Dianty wrote:
> Dear R users,
>
>
> I'm begginer in  R and using Package "SP" for my project to tried sample
> make SpatialPolygons object from gridTopology object , I follow the 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
>
>
>
> --
> View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Error-in-sample-package-SP-tp7582471.html
> Sent from the R-sig-geo mailing list archive at Nabble.com.
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>



More information about the R-sig-Geo mailing list