Dear R-SIG-GEO list I want to aggregate the mean value of points in a polygon using the over function. #Read the shapefile with the measurements shapefilename <- paste(shapefiledir,shortNameIndicator,"_",production.date,sep="") point.shapefile <- readShapePoints(paste(shapefilename,".shp",sep="")) names(slot(point.shapefile,'data')) <- c("ID",shortNameIndicator)
#aggregate per polygon by mean and save as shapefile aggregate.data<-over(studyzone,point.shapefile,fn=mean) row.names(aggregate.data) <- row.names(aggregate.data) outPolDF <- SpatialPolygonsDataFrame(studyzone,aggregate.data,match.ID=T) writePolyShape(outPolDF,paste(shapefiledir,shortNameIndicator,"_poly_",production.date,".shp",sep="")) While this works using the mean function I am unsure how to proceed for a weighted mean - does anyone have a suggestion? Many thanks Els _______________________________________________ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo