grattan_leaflet: Draw leaflet charts in grattan style

View source: R/grattan_leaflet.R

grattan_leafletR Documentation

Draw leaflet charts in grattan style

Description

Draw leaflet charts in grattan style

Usage

grattan_leaflet(
  DT,
  Year = c("2011", "2013", "2016"),
  simple = FALSE,
  na.value = "#6A737B"
)

Arguments

DT

A data frame whose first column is of the form SA[1-4]_(CODE|NAME)(11|16) as a key to join with ASGS shapefiles, or CED for Commonwealth Electoral Divisions. Other required names are fillColor, labelTitle, and labelText.

Year

The year to which DT applies. May be 2011 or 2016 for SA[1-4] shapefiles or 2013 or 2016 for CED.

simple

Use a simplified shapefile (if available)?

na.value

fillColor to use for unmatched polygons.

Value

A leaflet object; a map of Australia.

Examples

## Not run: 
library(readxl)
library(data.table)
library(magrittr)
library(grattanCharts)

DT <- 
  read_excel(system.file("extdata", "unemp.xlsx", package = "ASGS")) %>%
  setDT %>%
  .[, .(SA2_NAME11 = `Statistical Area Level 2 (SA2)`,
        fillColor = gpal(7)[Breaks], 
        labelText = `Statistical Area Level 2 (SA2)`,
        labelTitle = "Unemployment")]
        
grattan_leaflet(DT, Year = "2011")

## End(Not run)



HughParsonage/ASGS documentation built on Jan. 17, 2024, 12:16 p.m.