An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20100915/babd77f2/attachment.pl>
create an Hexagonal grid
4 messages · gianni lavaredo, Greg Snow, Breitbach, Nils +1 more
There is the hexbin package available through Bioconductor. It uses grid graphics I believe. If you want a base graphics solution, or just more hands on control (and using only CRAN packages), then check out the last example on the help page for the my.symbols function in the TeachingDemos package.
Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.snow at imail.org 801.408.8111 > -----Original Message----- > From: r-sig-geo-bounces at stat.math.ethz.ch [mailto:r-sig-geo- > bounces at stat.math.ethz.ch] On Behalf Of gianni lavaredo > Sent: Wednesday, September 15, 2010 9:29 AM > To: r-sig-geo at stat.math.ethz.ch > Subject: [R-sig-Geo] create an Hexagonal grid > > Dear reseacher, > > is there a way to create an Hexagonal grid with R? > > thanks > Gianni > > [[alternative HTML version deleted]] > > _______________________________________________ > R-sig-Geo mailing list > R-sig-Geo at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Dear Gianni, a good reference is the book "Applied Spatia lData Analysis with R", where there is an example in the Chapter "6.4 Hexagonal Grids" on page 137. Try this example using the test data set "meuse":
library(sp)
data(meuse.grid)
HexPts <- spsample(meuse.grid, type = "hexagonal", cellsize = 200)
spplot(meuse.grid["dist"], sp.layout = list("sp.points", HexPts, col = 1))
HexPols <- HexPoints2SpatialPolygons(HexPts)
df <- as.data.frame(meuse.grid)[overlay(meuse.grid, HexPts), ]
HexPolsDf<-SpatialPolygonsDataFrame(HexPols, df, match.ID = FALSE)
spplot(HexPolsDf["dist"])
More details in the above mentioned (very helpful) book. According to the book, there are no classes for hexagonal grids but some useful funtions to generate and plot them. Good luck! Nils
Von: r-sig-geo-bounces at stat.math.ethz.ch [r-sig-geo-bounces at stat.math.ethz.ch]" im Auftrag von "gianni lavaredo [gianni.lavaredo at gmail.com]
Gesendet: Mittwoch, 15. September 2010 17:29
Bis: r-sig-geo at stat.math.ethz.ch
Betreff: [R-sig-Geo] create an Hexagonal grid
Dear reseacher,
is there a way to create an Hexagonal grid with R?
thanks
Gianni
[[alternative HTML version deleted]]
_______________________________________________
R-sig-Geo mailing list
R-sig-Geo at stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
On Wed, 15 Sep 2010, Greg Snow wrote:
There is the hexbin package available through Bioconductor. It uses grid graphics I believe. If you want a base graphics solution, or just more hands on control (and using only CRAN packages), then check out the last example on the help page for the my.symbols function in the TeachingDemos package.
For sp objects, see the "hexagonal" type in spsample(), the low-level sp:::genHexGrid(), and HexPoints2SpatialPolygons(): hpts <- sp:::genHexGrid(dx=0.1, ll=c(0, 0), ur=c(1, 1)) pols <- HexPoints2SpatialPolygons(SpatialPoints(hpts)) plot(pols) Hope this helps, Roger
Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: Roger.Bivand at nhh.no