| st_hexbin | R Documentation |
Retrieve of set of hex-binned polygons for the given xyz data
st_hexbin(
x,
y,
z,
fun = c("mean", "count", "median")[2],
crs = ifelse(use_wkt("sf"), "epsg:4326",
"+proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0"),
na.rm = TRUE,
...
)
x |
a vector of x-locations |
y |
a vector of y-locations |
z |
a vector of values associated with each location |
fun |
character the function used to process the cell values currently only 'mean', 'median', or 'count' (default) |
crs |
the projection string |
na.rm |
logical passed through to user's selected function |
... |
further arguments for |
a POLYGON sf data frame
## Not run:
xyz <- hexbin_points()
hb <- st_hexbin(xyz$x, xyz$y, xyz$z)
hb <- dplyr::rename(hb, count = value)
pts <- sf::st_as_sf(xyz,
coords = c("x", "y"),
crs = "+init=epsg:4326",
agr = "identity")
plot(hb, asp = 1, reset = FALSE, axes = TRUE)
plot(pts, col = 'green', add = TRUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.