### Create a grid example Source: https://srkobakian.github.io/sugarbag/reference/create_grid.html Example usage showing how to generate centroids from a dataset and then create a grid using those centroids. ```R # Create a set of centroids for grid to overlay centroids <- create_centroids(tas_lga, "lga_code_2016") # Create the grid grid <- create_grid(centroids = centroids, hex_size = 0.2, buffer_dist = 1.2, verbose = FALSE) ``` -------------------------------- ### Example: allocate centroids to hexagon grid Source: https://srkobakian.github.io/sugarbag/reference/allocate.html Complete example that creates centroids, builds a hexagon grid, and allocates centroids to grid points using allocate(). The output messages indicate the allocation process. ```r # Create centroids set centroids <- create_centroids(tas_lga, sf_id = "lga_code_2016") # Smaller set for faster example centroids <- centroids[1:10,] # Create hexagon location grid data(capital_cities) grid <- create_grid(centroids = centroids, hex_size = 0.2, buffer_dist = 1.2) # Allocate polygon centroids to hexagon grid points hex_allocated <- allocate( centroids = centroids, hex_grid = grid, hex_size = 0.2, # same size used in create_grid hex_filter = 3, focal_points = capital_cities, width = 30, verbose = TRUE ) #> Finding closest point in focal_points data set. #> Allocating centroids, in order of distance to closest focal point. # NEXT: # create a set of hexagon points for plotting # using fortify_hexagon, and # plot the hexagons with geom_polygon, see vignette ``` -------------------------------- ### Load required libraries Source: https://srkobakian.github.io/sugarbag/index.html Initial setup to load the necessary packages for data manipulation and visualization. ```R library(sugarbag) library(dplyr) library(tidyr) library(tibble) library(ggplot2) library(ggthemes) ``` -------------------------------- ### create_hexmap example with tas_lga and capital_cities Source: https://srkobakian.github.io/sugarbag/reference/create_hexmap.html Example usage of create_hexmap with a subset of the tas_lga data and capital_cities as focal points. The output shows the buffer, hexagon size, and filter distances, and indicates that the filter distance was expanded for 22 areas. ```r data(tas_lga) # Smaller set for faster example tas_lga_sub <- tas_lga[1:10,] data(capital_cities) hexmap <- create_hexmap( shp = tas_lga_sub, sf_id = "lga_code_2016", hex_filter = 3, focal_points = capital_cities, verbose = TRUE) #> Buffer set to 0.9084 degrees. #> Converted hexagon size to 0.1717 degrees. #> Filter set to 0.5152 degrees. #> Finding closest point in focal_points data set. #> Allocating centroids, in order of distance to closest focal point. #> #> Filter distance was expanded for 22 area(s). ``` -------------------------------- ### Install development version of sugarbag from GitHub Source: https://srkobakian.github.io/sugarbag/index.html Use these commands to install the development version of the package from the GitHub repository using the remotes package. ```R install.packages("remotes") remotes::install_github("srkobakian/sugarbag") ``` -------------------------------- ### Example: create_centroids with tas_lga Source: https://srkobakian.github.io/sugarbag/reference/create_centroids.html Example call to create_centroids using the tas_lga sf object and the lga_code_2016 column. Returns a tibble with longitude and latitude centroids. ```r centroids <- create_centroids(tas_lga, "lga_code_2016") ``` -------------------------------- ### Create centroids and grid for create_buffer Source: https://srkobakian.github.io/sugarbag/reference/create_buffer.html Example usage of create_buffer: first create centroids from tas_lga using create_centroids, then create a grid with create_grid using hex_size 0.2 and buffer_dist 1.2. The resulting grid is used as input to create_buffer. ```r lga_centroids <- create_centroids(sugarbag::tas_lga, "lga_code_2016") lga_grid <- create_grid(lga_centroids, hex_size = 0.2, buffer_dist = 1.2) ``` -------------------------------- ### Example: Finding the Closest Capital City Source: https://srkobakian.github.io/sugarbag/reference/closest_focal_point.html Demonstrates creating polygon centroids and finding the closest capital city for the first centroid in the set. ```R # Create a set of polygon centroids centroids <- create_centroids(tas_sa2, "sa2_5dig_2016") # Find the closest capital city for the first centroid closest_focal_point(centroids[1, ], capital_cities) #> # A tibble: 1 × 5 #> points focal_longitude focal_latitude focal_distance angle #> #> 1 Hobart 147. -42.9 16750. -35.5 ``` -------------------------------- ### Install CRAN release of sugarbag Source: https://srkobakian.github.io/sugarbag/index.html Use this command to install the stable version of the package from CRAN. ```R install.packages("sugarbag") ``` -------------------------------- ### fortify_hexagon example with tas_lga_hexctr Source: https://srkobakian.github.io/sugarbag/reference/fortify_hexagon.html Example call to fortify_hexagon using the tas_lga_hexctr data and the same sf_id column used in create_centroids. The output is a tibble with 174 rows and 16 columns, showing the seven points per hexagon and additional attributes such as focal coordinates, hexagon identifiers, and polygon type. ```r # same column is used in create_centroids fortify_hexagon(data = tas_lga_hexctr, sf_id = "lga_code_2016", hex_size = 0.2) #> # A tibble: 174 × 16 #> lga_code_2016 longitude latitude points focal_longitude focal_latitude #> #> 1 60210 148. -41.4 Hobart 147. -42.9 #> 2 60210 148. -41.4 Hobart 147. -42.9 #> 3 60210 148. -41.4 Hobart 147. -42.9 #> 4 60210 148. -41.4 Hobart 147. -42.9 #> 5 60210 148. -41.4 Hobart 147. -42.9 #> 6 60210 148. -41.4 Hobart 147. -42.9 #> 7 60410 147. -42.7 Hobart 147. -42.9 #> 8 60410 147. -42.7 Hobart 147. -42.9 #> 9 60410 147. -42.7 Hobart 147. -42.9 #> 10 60410 147. -42.7 Hobart 147. -42.9 #> # ℹ 164 more rows #> # ℹ 10 more variables: focal_dist , focal_angle , rownumber , #> # hex_long , hex_lat , hex_id , long , lat , #> # point_id , poly_type ``` -------------------------------- ### create_grid(centroids, hex_size, buffer_dist, latitude, longitude, verbose) Source: https://srkobakian.github.io/sugarbag/reference/create_grid.html Creates a grid of evenly spaced points to allow hexagons to tessellate. It takes a data frame of centroids and returns a grid object. ```APIDOC ## create_grid(centroids, hex_size, buffer_dist, latitude, longitude, verbose) ### Description Creates a grid of evenly spaced points to allow hexagons to tessellate. It takes a data frame of centroids and returns a grid object. ### Function Signature create_grid(centroids, hex_size, buffer_dist, latitude = "latitude", longitude = "longitude", verbose = FALSE) ### Parameters - **centroids** (data frame) - Required - Data frame of centroids to be allocated, should have columns for longitude and latitude values. - **hex_size** (float) - Required - A float value in degrees for the diameter of the hexagons. - **buffer_dist** (numeric) - Required - Distance to extend beyond the geometry provided. - **latitude** (string) - Optional - The column name for the latitude values of the centroids. Default is "latitude". - **longitude** (string) - Optional - The column name for the longitude values of the centroids. Default is "longitude". - **verbose** (boolean) - Optional - A boolean to indicate whether to show function progress. Default is FALSE. ### Return Value - **grid** - The created grid object. ### Example ```r # Create a set of centroids for grid to overlay centroids <- create_centroids(tas_lga, "lga_code_2016") # Create the grid grid <- create_grid(centroids = centroids, hex_size = 0.2, buffer_dist = 1.2, verbose = FALSE) ``` ``` -------------------------------- ### create_buffer(centroids, grid, hex_size, buffer_dist, verbose = FALSE) Source: https://srkobakian.github.io/sugarbag/reference/create_buffer.html Creates a buffer of points around centroids to extend beyond the outermost centroids, used for hexagon tessellation. It takes centroids, a grid of hexagon centroids, hexagon size, and buffer distance, and returns a data frame of hexagon centroids. ```APIDOC ## create_buffer(centroids, grid, hex_size, buffer_dist, verbose = FALSE) ### Description Creates a buffer of points around centroids to extend beyond the outermost centroids, used for hexagon tessellation. It takes centroids, a grid of hexagon centroids, hexagon size, and buffer distance, and returns a data frame of hexagon centroids. ### Usage ```r create_buffer(centroids, grid, hex_size, buffer_dist, verbose = FALSE) ``` ### Arguments - **centroids** (data frame) - Required - data frame of centroids to be allocated - **grid** (data frame) - Required - data frame of hexagon centroids - **hex_size** (float) - Required - a float value in degrees for the diameter of the hexagons - **buffer_dist** (numeric) - Required - distance to extend beyond the geometry provided - **verbose** (boolean) - Optional - a boolean to indicate whether to show function progress ### Value Data frame of hexagon centroids ### Examples ```r lga_centroids <- create_centroids(sugarbag::tas_lga, "lga_code_2016") lga_grid <- create_grid(lga_centroids, hex_size = 0.2, buffer_dist = 1.2) ``` ``` -------------------------------- ### allocate function signature Source: https://srkobakian.github.io/sugarbag/reference/allocate.html Shows the formal arguments of the allocate() function, including centroids, hex_grid, sf_id, hex_size, hex_filter, focal_points, order_sf_id, width, and verbose. ```r allocate( centroids, hex_grid, sf_id = names(centroids)[1], hex_size, hex_filter, focal_points = NULL, order_sf_id = NULL, width = 30, verbose ) ``` -------------------------------- ### fortify_hexagon(data, sf_id, hex_size) Source: https://srkobakian.github.io/sugarbag/reference/fortify_hexagon.html Creates the points that define a hexagon polygon for plotting. It takes a data frame created by the allocate function and returns a data frame of the seven points used to draw a hexagon. ```APIDOC ## fortify_hexagon(data, sf_id, hex_size) ### Description Creates the points that define a hexagon polygon for plotting. ### Usage ```r 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 ```r # same column is used in create_centroids fortify_hexagon(data = tas_lga_hexctr, sf_id = "lga_code_2016", hex_size = 0.2) #> # A tibble: 174 × 16 #> lga_code_2016 longitude latitude points focal_longitude focal_latitude #> #> 1 60210 148. -41.4 Hobart 147. -42.9 #> 2 60210 148. -41.4 Hobart 147. -42.9 #> 3 60210 148. -41.4 Hobart 147. -42.9 #> 4 60210 148. -41.4 Hobart 147. -42.9 #> 5 60210 148. -41.4 Hobart 147. -42.9 #> 6 60210 148. -41.4 Hobart 147. -42.9 #> 7 60410 147. -42.7 Hobart 147. -42.9 #> 8 60410 147. -42.7 Hobart 147. -42.9 #> 9 60410 147. -42.7 Hobart 147. -42.9 #> 10 60410 147. -42.7 Hobart 147. -42.9 #> # ℹ 164 more rows #> # ℹ 10 more variables: focal_dist , focal_angle , rownumber , #> # hex_long , hex_lat , hex_id , long , lat , #> # point_id , poly_type ``` ``` -------------------------------- ### Fortify hexagons and plot static map Source: https://srkobakian.github.io/sugarbag/articles/Tasmania.html Prepares hexagon and geographic polygon data for plotting, then creates a static map with `ggplot`. The `fortify_hexagon` function generates six points per region for hexagon plotting, and `fortify_sfc` converts the original polygons. The plot uses `sa4_name_2016` for fill and `scale_fill_viridis_d()` for colour. ```r hexagons <- hex_allocated %>% fortify_hexagon(hex_size = 0.2, sf_id = "sa2_name_2016") %>% left_join(., tas_sa2) %>% mutate(poly_type = "hex") #> Joining with `by = join_by(sa2_name_2016)` polygons <- fortify_sfc(tas_sa2) %>% mutate(poly_type = "geo") ggplot(mapping = aes(fill = sa4_name_2016)) + geom_polygon(data = polygons, aes(x=long, lat, group = interaction(sa2_name_2016,polygon)), alpha = 0.4) + geom_polygon(data = hexagons, aes(x=long, lat, group = interaction(sa2_name_2016))) + scale_fill_viridis_d() ``` -------------------------------- ### Create and save animation with gganimate Source: https://srkobakian.github.io/sugarbag/articles/Tasmania.html Creates an animated map transitioning between hexagon and geographic views using `gganimate`. Requires the `transformr` package for tweening and `gifski` for GIF output. The animation is saved as `tasmania_animation.gif` with 10 fps, 15 seconds duration, and 5-second start/end pauses. ```r library(gganimate) library(transformr) animation <- animate_tas %>% ggplot(aes(x=long, y=lat, group = interaction(polygon, sa2_name_2016))) + geom_polygon(aes(fill = sa4_name_2016)) + geom_polygon(data = polygon_points %>% select(-poly_type), fill = "grey40", alpha = 0.05) + coord_equal() + theme_void() + guides(fill = guide_legend(title = NULL)) + theme(legend.position = "bottom") + transition_states(states = poly_type) + scale_fill_viridis_d() animated <- animate(animation, fps = 10, duration = 15, start_pause = 5, end_pause = 5, rewind = FALSE) anim_save(filename = "tasmania_animation.gif", animated) ``` -------------------------------- ### allocate() Source: https://srkobakian.github.io/sugarbag/reference/allocate.html Chooses a hexagon centroid for each polygon in the shape file, from a grid spanning the longitudes and latitudes in the expanded bounding box. Returns a data frame of all allocated hexagon points. ```APIDOC ## allocate(centroids, hex_grid, sf_id, hex_size, hex_filter, focal_points, order_sf_id, width, verbose) ### Description Chooses a hexagon centroid for each polygon in the shape file, from a grid spanning the longitudes and latitudes in the expanded bounding box. ### Usage ```r allocate( centroids, hex_grid, sf_id = names(centroids)[1], hex_size, hex_filter, focal_points = NULL, order_sf_id = NULL, width = 30, verbose ) ``` ### Arguments - **centroids** (data.frame) - Required - a data frame with centroids of non empty polygons - **hex_grid** (data.frame) - Required - a data frame containing all possible hexagon points - **sf_id** (string) - Optional - a string to indicate the column to identify individual polygons - **hex_size** (float) - Required - a float value in degrees for the diameter of the hexagons - **hex_filter** (numeric) - Required - amount of hexagons around centroid to consider - **focal_points** (data.frame) - Optional - a data frame of reference locations when allocating hexagons - **order_sf_id** (string) - Optional - a string to indicate the column used to order polygons - **width** (numeric) - Optional - a numeric indicating the angle used to filter the hexagon grid - **verbose** (boolean) - Required - a boolean to indicate whether to show polygon id ### Value a data frame of all allocated hexagon points ### Examples ```r centroids <- create_centroids(tas_lga, sf_id = "lga_code_2016") centroids <- centroids[1:10,] data(capital_cities) grid <- create_grid(centroids = centroids, hex_size = 0.2, buffer_dist = 1.2) hex_allocated <- allocate( centroids = centroids, hex_grid = grid, hex_size = 0.2, hex_filter = 3, focal_points = capital_cities, width = 30, verbose = TRUE ) ``` #> Finding closest point in focal_points data set. #> Allocating centroids, in order of distance to closest focal point. ``` -------------------------------- ### create_grid function signature Source: https://srkobakian.github.io/sugarbag/reference/create_grid.html The function signature for create_grid, defining the required parameters for centroid input, hexagon size, and buffer distance. ```R create_grid( centroids, hex_size, buffer_dist, latitude = "latitude", longitude = "longitude", verbose = FALSE ) ``` -------------------------------- ### Allocate centroids to hexagon grid with allocate Source: https://srkobakian.github.io/sugarbag/articles/Tasmania.html Allocates each polygon centroid to the closest available hexagon grid point. Uses `capital_cities` as focal points to preserve neighbourly relationships. The output includes a message about finding the closest focal point and allocating centroids in order of distance. ```r # Allocate the centroids to the hexagon grid # We have the same amount of rows, as individual regions hex_allocated <- allocate(centroids = centroids, sf_id = "sa2_name_2016", hex_grid = grid, hex_size = 0.2, # same size used in create_grid hex_filter = 10, focal_points = capital_cities, # same column used in create_centroids width = 30, verbose = TRUE) #> Finding closest point in focal_points data set. #> Allocating centroids, in order of distance to closest focal point. ``` -------------------------------- ### create_buffer function signature Source: https://srkobakian.github.io/sugarbag/reference/create_buffer.html Function signature for create_buffer, which expands points to extend beyond the outermost centroids. Called from within create_grid, it takes the bounding box of a group of polygons or a table of min/max longitudes and latitudes to create points for each polygon that will tessellate into hexagons. ```r create_buffer(centroids, grid, hex_size, buffer_dist, verbose = FALSE) ``` -------------------------------- ### Create grid of hexagon locations Source: https://srkobakian.github.io/sugarbag/index.html Generates a grid of evenly spaced locations for hexagon placement. ```R grid <- create_grid(centroids = centroids, hex_size = 0.2, buffer_dist = 1.2) ``` -------------------------------- ### Load required libraries for sugarbag hexagon map Source: https://srkobakian.github.io/sugarbag/articles/Tasmania.html Loads the sugarbag package and its dependencies (dplyr, tidyr, tibble, ggplot2, sf) needed for creating hexagon maps. ```R library(sugarbag) library(dplyr) library(tidyr) library(tibble) library(ggplot2) library(sf) ``` -------------------------------- ### Prepare animation data and plot facets Source: https://srkobakian.github.io/sugarbag/articles/Tasmania.html Combines hexagon and polygon points into a single data frame for animation, joining with `homeless` data. The `left_join` produces a many-to-many warning, which is expected. The resulting `ggplot` uses `facet_wrap(~poly_type)` to show hexagon and geographic views side by side. ```r hexagon_points <- hexagons %>% select(sa4_name_2016, sa2_name_2016, sa2_name_2016, long, lat, poly_type) %>% left_join(polygons %>% distinct(sa2_name_2016, polygon), by = "sa2_name_2016") #> Warning in left_join(., polygons %>% distinct(sa2_name_2016, polygon), by = "sa2_name_2016"): Detected an unexpected many-to-many relationship between `x` and `y`. #> ℹ Row 31 of `x` matches multiple rows in `y`. #> ℹ Row 183 of `y` matches multiple rows in `x`. #> ℹ If a many-to-many relationship is expected, set `relationship = #> "many-to-many"` to silence this warning. polygon_points <- polygons %>% select(sa4_name_2016, sa2_name_2016, long, lat, polygon, poly_type) animate_tas <- bind_rows(hexagon_points, polygon_points) %>% left_join(homeless, by = "sa2_name_2016") animate_tas %>% ggplot(aes(x=long, y=lat, group = interaction(polygon, sa2_name_2016))) + geom_polygon(aes(fill = sa4_name_2016)) + geom_polygon(data = polygon_points %>% select(-poly_type), fill = "grey40", alpha = 0.05) + coord_equal() + theme_void() + guides(fill = guide_legend(title = NULL)) + theme(legend.position = "bottom") + facet_wrap(~poly_type) + scale_fill_viridis_d() ``` -------------------------------- ### create_hexmap function signature Source: https://srkobakian.github.io/sugarbag/reference/create_hexmap.html Function signature for create_hexmap. Use this to understand the required and optional arguments when calling the function. The function allocates each polygon in a shape file to a grid point to create a map of tessellated hexagons, preserving spatial relationships while losing geographic shape. ```r create_hexmap( shp, sf_id, hex_size = NULL, buffer_dist = NULL, hex_filter = 10, f_width = 30, focal_points = NULL, order_sf_id = NULL, export_shp = FALSE, verbose = FALSE ) ``` -------------------------------- ### create_centroids function signature Source: https://srkobakian.github.io/sugarbag/reference/create_centroids.html Function signature for create_centroids. It takes an sf object, a column name for polygon identifiers, and optional arguments for centroid calculation and progress reporting. ```r create_centroids(shp_sf, sf_id, largest = TRUE, verbose = FALSE) ``` -------------------------------- ### Create centroids with create_centroids Source: https://srkobakian.github.io/sugarbag/articles/Tasmania.html Computes the central point (centroid) for each polygon in the `tas_sa2` data set, using the `sa2_name_2016` column as the unique identifier. The result is stored in `centroids` for later use in grid creation and allocation. ```r # Find the longitude and latitude centroid for each region or area centroids <- create_centroids(tas_sa2, sf_id = "sa2_name_2016") ``` -------------------------------- ### filter_grid_points(f_grid, f_centroid, focal_points = NULL, f_dist = filter_dist, angle_width = width, h_size = hex_size) Source: https://srkobakian.github.io/sugarbag/reference/filter_grid_points.html Filters a complete grid of hexagon centroids to those within a specified distance of a given centroid, optionally considering focal points and angle width. ```APIDOC ## filter_grid_points(f_grid, f_centroid, focal_points = NULL, f_dist = filter_dist, angle_width = width, h_size = hex_size) ### Description Takes only the closest available gridpoints as possible hexagon centroids to allocate polygons. ### Usage ```r filter_grid_points( f_grid, f_centroid, focal_points = NULL, f_dist = filter_dist, angle_width = width, h_size = hex_size ) ``` ### Arguments - **f_grid** - complete grid of hexagon centroids - **f_centroid** - the longitude and latitude values for the current centroid - **focal_points** - a tibble of focal locations, an optional argument that allows allocation of polygons to hexagon centroids in ascending order of the distance to the closest focal point. It also filters the grid points to those within a 30 degree range of the angle from focal point to centroid. The default "capitals" uses the locations of the Australian capital cities as focal points. - **f_dist** - a distance in degrees, used as a boundary to filter the hexagon centroids considered for each polygon centroid to be allocated. - **angle_width** - a numeric used to filter the hexagon grid - **h_size** - a float value in degrees for the diameter of the hexagons ### Value A tibble of filtered grid points. ``` -------------------------------- ### fortify_hexagon function signature Source: https://srkobakian.github.io/sugarbag/reference/fortify_hexagon.html Usage signature for the fortify_hexagon function. It takes a data frame created by the allocate function, a column name identifying individual polygons, and a float hexagon diameter in degrees. ```r fortify_hexagon(data, sf_id, hex_size) ``` -------------------------------- ### Visualise hexagon map Source: https://srkobakian.github.io/sugarbag/index.html Fortifies the allocated data and plots the hexagon map using ggplot2. ```R hexagons <- fortify_hexagon(data = hex_allocated, sf_id = "lga_code_2016", hex_size = 0.2) polygons <- fortify_sfc(tas_lga) %>% mutate(poly_type = "geo") ggplot(mapping = aes(fill = lga_code_2016)) + geom_polygon(data = polygons, aes(x=long, lat, group = interaction(lga_code_2016, polygon)), alpha = 0.4) + geom_polygon(data = hexagons, aes(x=long, lat, group = interaction(lga_code_2016))) + scale_fill_viridis_d() + theme_map() + theme(legend.position = "none", aspect.ratio = 1) ``` -------------------------------- ### Function Signature: closest_focal_point Source: https://srkobakian.github.io/sugarbag/reference/closest_focal_point.html The basic function signature for calculating the closest focal point given a centroid and a set of focal points. ```R closest_focal_point(centroid, focal_points) ``` -------------------------------- ### Allocate polygon areas to hexagon locations Source: https://srkobakian.github.io/sugarbag/index.html Assigns each polygon centroid to the closest available hexagon grid point. ```R # Allocate the centroids to the hexagon grid # We have the same amount of rows, as individual regions hex_allocated <- allocate( centroids = centroids, hex_grid = grid, hex_size = 0.2, # same size used in create_grid hex_filter = 3, focal_points = capital_cities, width = 30, verbose = TRUE ) ``` -------------------------------- ### Filter grid points with filter_grid_points() Source: https://srkobakian.github.io/sugarbag/reference/filter_grid_points.html Filters a complete grid of hexagon centroids to those within a specified distance (f_dist) of the current centroid, optionally using focal points to prioritize centroids by distance and angle. The function returns a tibble of filtered grid points. ```r filter_grid_points( f_grid, f_centroid, focal_points = NULL, f_dist = filter_dist, angle_width = width, h_size = hex_size ) ``` -------------------------------- ### Calculate centroids from polygons Source: https://srkobakian.github.io/sugarbag/index.html Finds the central longitude and latitude points for each region or area. ```R # Find the longitude and latitude centroid for each region or area centroids <- create_centroids(tas_lga, "lga_code_2016") ``` -------------------------------- ### Convert to long lat with st_transform Source: https://srkobakian.github.io/sugarbag/articles/Tasmania.html Converts spatial data to longitude/latitude coordinates using the GRS80 ellipsoid. Used as a step in the workflow to prepare data for centroid calculation. ```r st_transform(., crs = "+proj=longlat +ellps=GRS80") ``` -------------------------------- ### Filter Tasmanian SA2 areas from Australian data using strayr Source: https://srkobakian.github.io/sugarbag/articles/Tasmania.html Alternative data preparation: filters the full Australian SA2 dataset from the strayr package to include only Tasmanian areas, using the state_name_2016 column. ```R library(strayr) strayr::sa22016 %>% filter(state_name_2016 == "Tasmania") %>% ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.