I'm working on spatial polygon data frame (spdf) dataset. This dataset contains a time series of monthly climate data. What I'm trying to achieve is to convert the spdf to raster stack with 1000m resolution for further statistical analysis. I've writen an R code but is is very slow and it took ages to convert one column.I would appreciate if any of you could suggest tips to make it faster.
hru<-readOGR("E:\\Tade\\HRU\\ubn_merge.shp",layer="ubn_merge") # spatial polygon
spdf<-merge(hru,spdf.2000,by.x="HRU",by.y="HRU",all.x=T,sort=F) # spdf nrow=565 ncol=375
# convert sp to raster
hru.ras<-raster(hru,resolution=1000) # raster hru shape to 1km
for (i in 1:length(spdf){
et.ras<-rasterize(spdf,hru.ras,field=paste("m",1,sep="")) # rasterize
et.stack<-stack(et.stack,et.ras)
}
Thanks