I'm trying to convert my map (a SpatialPolygonsDataFrame) into a raster, using rasterize function, here is a bug that I don't understand...
> class(parcel) # this is my map
[1] "SpatialPolygonsDataFrame"
> attr(,"package")
[1] "sp"
> head(parcel)
AREAHA RECNO AREA AREASQKM OS_06 GRD_CAT_06
0 0.0519 0 519.1941 0 chemin prive way
1 0.0127 1 127.0963 0 chemin prive way
2 0.0596 2 596.2204 0 chemin prive way
3 0.0248 3 248.0452 0 route D90 way
4 0.0375 4 375.0141 0 route privee way
5 0.1260 5 1260.3941 0 chemin prive way
> dim(parcel)
[1] 20069 6
> object.size(parcel)
88090144 bytes
> r <- raster(ncol=4001, nrow=4001)
> extent(r) <- extent(parcel)
> parcel_ras<-rasterize(parcel, r, "GRD_CAT_06", CRS("+init=epsg:27572"))
Erreur dans data.frame(ID = as.integer(putvals), value = lvs) : arguments imply differing number of rows: 20069, 13
I just don't understand this comment : what is "putvals" ? There are 20069 polygons in my map, so what is "13" ?
I can't reproduce a smaller example of my map, so here are my data : http://dl.free.fr/fxdT2oczB