/CPALtools

Package of custom R functions used by the Child Poverty Action Lab

Primary LanguageRMIT LicenseMIT

CPALtools

CPALtools is an R package containing custom functions used by the Child Poverty Action Lab across its work streams.

Install from github with the following command:

r devtools::install_github("childpovertyactionlab/CPALtools")

Theme Functions

theme_cpal: ggplot2 base theme for CPAL graphics.

font_cpal: Used to install Poppins font from Google for use with ggplot2.

bar_pos_neg: Reactable function for a positive and negative bar chart.

GIS Functions

GeoIntersect: Intersects two sf geometries and computes area and percent of area intersect for estimating population variables.

Utility Functions

extract_city: Function used to extract city name from address string column. Not fully accurate and still being developed.

extract_zip: Function used to extract zip code from address string column.

Data and Objects

acs_variables: Object containing the name of American Community Survey variables commonly used as metrics in CPAL analysis.

cpal_leaflet: Leaflet map style attribution.

cpal_mapbox: CPAL mapbox style link.

dpd_vgc: List of incident types used to identify Violent Gun Crime at the Dallas Police Department.

ntx_county: List of the eight North Texas counties surrounding Dallas County.

pal_cpalfac: Hex color codes to CPAL standards for factor variables. Includes ten hex codes.

pal_cpaldiv: Hex color codes to CPAL standards for diverging scale graphics.

pal_cpaltri: Hex color codes to CPAL standards for three variables.