Re: [R-sig-Geo] Calculate percent cover in a raster

2016-02-16 Thread Thiago V. dos Santos
Hi Ben, Thanks for your suggestion - it works great. What I ended up using was this: require(raster) ## scratch a raster and fill some random values r <- raster(nrows=22, ncols=20, xmn=-58, xmx=-48, ymn=-33, ymx=-22) r[] <- round(runif(22 * 20, min=0, max=600), digits=0) # Count raster cells (

Re: [R-sig-Geo] Calculate percent cover in a raster

2016-02-16 Thread Ben Tupper
Hi, I think you can use raster::reclassify() or raster::cut() to bin your rainfall. intervals <- seq(from = 0, to = 600, by = 100) ix <- cut(r, breaks = intervals) tx <- table(as.vector(ix)) tx 1 2 3 4 5 6 46 64 85 76 100 69 tx/sum(tx)*100 1234

[R-sig-Geo] Calculate percent cover in a raster

2016-02-16 Thread Thiago V. dos Santos
Hi all, I have a raster at 0.5 degree resolution with monthly totals of rainfall, which range from 50 mm to 600 mm: require(raster) ## scratch a raster and fill some random values r <- raster(nrows=22, ncols=20, xmn=-58, xmx=-48, ymn=-33, ymx=-22) r[] <- round(runif(22 * 20, min=50, max=600), d

Re: [R-sig-Geo] different projection transformation R and gdal commandline

2016-02-16 Thread Dominik Schneider
Oh, silly me. doing plot(spTransform(box,CRS(pstring))) and it's obvious what's happening. The projection rotates the polygon such that for the corners y1,x1 and y2,x2 y1 != y2. But ymin(spTransform(box,CRS(pstring))) still gives you the smallest coordinate regardless of which corner it is. Usin

[R-sig-Geo] R Techniques on uDig GIS

2016-02-16 Thread Mahmut Cavur
Hello Dear All, I am a Phd Candidate at METU in Turkey studying about geospatial analysis. I have a study to embedd several R techniques into a GIS software (uDig- Free and Open Source). Actually the study aims to provide a framework and methodology for developers to embed any geospatai R techniqu

Re: [R-sig-Geo] different projection transformation R and gdal commandline

2016-02-16 Thread Dominik Schneider
Hi Chris, Thanks for confirming this. I'm not surprised that gdalUtils gives the same answer as the gdal utilities - my understanding is that gdalUtils is basically the equivalent to calling the commandline utilities via system(). I'm hoping that someone can shed light on spTransform since I use th

Re: [R-sig-Geo] slope of regression line in moran scatter plot

2016-02-16 Thread Takahiro Yoshida
I am sorry. I forgot to add the R-Codes. Best, Takahiro library(spdep) data(baltimore) # head(baltimore) plot(baltimore$X, baltimore$Y) nb <- knn2nb(knearneigh(cbind(baltimore$X, baltimore$Y), k=4)) listW <- nb2listw(nb, style="W") W <- listw2mat(listW) y <- baltimore$PRICE