Re: [R-sig-Geo] Clipping a Map

2013-11-22 Thread Jesse Berman
Hi Ravi, After performing 'gIntersects' try merging this result to your dataframe, then select the TRUE values? Jesse cz_zip - gIntersects(camapzip_temp,camap_base, byid=TRUE) camap_base@data-cbind(camap_base@data, czip) camap2-camap_base[(camap_base@data[,/???/] %in% c(TRUE)),] # Insert your

Re: [R-sig-Geo] spplot class intervals

2013-10-22 Thread Jesse Berman
Milan, Try using the function 'cuts' instead of at=c(). Jesse library(sp) data(meuse) coordinates(meuse)=~x+y spplot(meuse, cadmium, do.log = TRUE, key.space=list(x=0.2,y=0.9,corner=c(0,1)), cuts=c(1, 2, 3, 4, 10, 20), # My custom cuts scales=list(draw=T)) -

Re: [R-sig-Geo] overlay a ppp object and a SpatialPolygon

2013-10-03 Thread Jesse Berman
Hi Laetitia, Try turning your .ppp object into a spatial grid data frame, then convert it to a raster. The 'extract' function should then work if your projections are correct. Jesse your.ppp.object-as.SpatialGridDataFrame.im(your.ppp.object) rast.ppp.object- raster(your.ppp.object) #Convert

Re: [R-sig-Geo] How to do Zonal Statistics after Kriging in R given Shapefile of Polygon

2013-09-12 Thread Jesse Berman
James, it seems like your projections for 'town' and 'muni.sp' are different with one being lat/long and the other being a UTM Zonal. Try setting them the same and see if that solves your problem. Jesse - Jesse D Berman, PhD Yale

[R-sig-Geo] Singular Matrix Error

2013-07-19 Thread Jesse Berman
Hi All, I want to perform ordinary kriging on a series of air pollution values, but am getting the error / IL.Jul7.ok-krige(Arithmetic.Mean~1, IL.Jul7, model=ILvgm.jul7, newdata=IL2.map) [using ordinary kriging] chfactor.c, line 131: singular matrix in function LDLfactor() Error in

Re: [R-sig-Geo] predict function of regressors in the raster package

2013-04-04 Thread Jesse Berman
Hi Hein, I'm not sure if this will help, but one thing to check is that your prediction grid has covariate data for each of the 40,000 cells. If a large number of cells have 'NA' as data values, then sometimes the prediction will not work. Offhandedly, it strikes me that ycoord may be limited

[R-sig-Geo] Maptools package

2013-04-03 Thread Jesse Berman
Hi all, I've loaded the new version of R 3.0.0 and it seems the package 'maptools' is not available on the mirrors. It's not urgent, but I'm curious if anyone knows when it might become available? Thanks. Regards, Jesse -- View this message in context:

[R-sig-Geo] Large Prediction Variances with gstat

2013-02-28 Thread Jesse Berman
Hi All, First time post, so please excuse any omissions/confusion. I am performing a series of prediction models using gstat and discovered that prediction variance of spatially dependent data with OLS models was larger than those of kriging models. This is counter-intuitive to the assumption

Re: [R-sig-Geo] crop and overlay question

2013-02-28 Thread Jesse Berman
Hi Erin, I'm sure someone else will have a more elegant solution, but if you need a quick fix try this (adapted from your posted code) Jesse tmp - map(state,Texas,fill=TRUE,plot=FALSE) texas.boundary - map2SpatialPolygons(tmp, IDs=tmp$names, proj4string=CRS(+proj=longlat +datum=WGS84