Expand this to see code
library(tidyverse)
library(janitor)This notebook helps us join together our unit-focused data and our weather station-focused data. The data was compiled by Media Innovation Group data fellows. The information came from the Texas Department of Criminal Justice website, a TDCJ unit prototype list and the National Weather Service website.
Clean up our column names so we can easily combine with our other data.
library(tidyverse)
library(janitor)Option
eval: fasleset to avoid re-download. Change to true for updates.
# download.file(
# "https://docs.google.com/spreadsheets/d/e/2PACX-1vRebFs9O2i0HoygXTtIvuzdVTmyrjX3MeUorU9d4fpYkGX7Bb026OradFQ1MMk2ltcGnyILih6ow4F4/pub?gid=1653039441&single=true&output=csv",
# "data-original/unit-nws-info.csv")Let’s bring in our unit info sheet. This was compiled by us to be used in this project.
nws_unit_raw <- read_csv("data-original/unit-nws-info.csv") |> clean_names()Rows: 101 Columns: 12
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (11): Unit Name, Region, Data Fellow, NWS, NWS ID, Unit Code, Type, Stre...
dbl (1): Driving miles
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
nws_unit_raw |> head()I’m gonna change column names and only keep the columns we need.
unit_info_clean <- nws_unit_raw |>
select(unit_name, region, unit_code, type, nws, nws_id, county)
unit_info_cleanOur cleaning was pretty easy! Let’s export the data and put it into our processed folder now.
unit_info_clean |> write_rds("data-processed/01-unit-info-cleaned.rds")