Learn R Programming

sugarbag (version 0.1.3)

fortify_hexagon: Creates the points that define a hexagon polygon for plotting

Description

Creates the points that define a hexagon polygon for plotting

Usage

fortify_hexagon(data, sf_id, hex_size)

Arguments

data

a data frame created by the allocate function

sf_id

a string to indicate the column to identify individual polygons

hex_size

a float value in degrees for the diameter of the hexagons

Value

a data frame of the seven points used to draw a hexagon

Examples

Run this code
# NOT RUN {
# Create centroids set
centroids <- create_centroids(tas_lga, "LGA_CODE16")
# Create hexagon location grid
grid <- create_grid(centroids = centroids, hex_size = 0.2, buffer_dist = 1.2)
# Allocate polygon centroids to hexagon grid points
allocated <- allocate(
  centroids = centroids,
  sf_id = "LGA_CODE16",
  hex_grid = grid,
  hex_size = 0.2, # same size used in create_grid
  hex_filter = 1,
  width = 30,
  focal_points = capital_cities,
  verbose = TRUE
)
# same column used in create_centroids
fortify_hexagon(data = allocated, sf_id = "LGA_CODE16", hex_size = 0.2)
# }

Run the code above in your browser using DataLab