[R-sig-Geo] Creating SpatialGridDataFrame - unequal number of objects
Edzer Pebesma
edzer.pebesma at uni-muenster.de
Sun May 29 14:29:58 CEST 2011
Your example below is very hard to read. But if I understand it
correctly, the following change,
bike_df <- as.data.frame(as.vector(bike_mat))
may result in something that is syntactically correct; whether it does
what you want is not clear from the context.
Hth,
On 05/28/2011 06:18 PM, Chris English wrote:
>
> Dear List:
> I have a SpatialGrid for which I am trying to make adata.frame and thence a SpatialGridDataFrame.
> I can't seem to get the size of data.frame and gridto match up. I assume I'm missing something straight forward.
>
> summary(grid1)Object of class SpatialGridCoordinates: min maxx 0.5 1824.5y 0.5 1368.5Is projected: NA proj4string : [NA]Number of points: 2Grid attributes: cellcentre.offset cellsize cells.dimx 1 1 1824y 1 1 1368> help(str)> bike_mat<- matrix(rep(1368:1, each=1824), ncol=1824, byrow=TRUE)> bike_df<- as.data.frame(bike_mat)> bike_sgdf_1<- SpatialGridDataFrame(grid1,bike_df)Error in validityMethod(object) : unequal number of objects in full grid and data slot
> Thank you for you assistance.
> Chris
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
--
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763 http://ifgi.uni-muenster.de
http://www.52north.org/geostatistics e.pebesma at wwu.de
More information about the R-sig-Geo
mailing list