Skip to content

Commit 603bfc4

Browse files
committed
ID, MA
1 parent b8a4b98 commit 603bfc4

13 files changed

+1188
-185
lines changed

state/id/expends/docs/id_expends_diary_2020-present.Rmd

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,10 +468,20 @@ glimpse(sample_n(ide, 1000))
468468

469469
## Export
470470

471+
```{r}
472+
ide <- ide %>%
473+
rename_all(~str_replace(., "_swap", "_clean")) %>%
474+
select(-ends_with("city_norm")) %>%
475+
rename_all(~str_replace(., "_norm", "_clean")) %>%
476+
rename_all(~str_remove(., "_raw"))
477+
```
478+
479+
471480
Now the file can be saved on disk for upload to the Accountability server. We
472481
will name the object using a date range of the records included.
473482

474483
```{r clean-timestamp}
484+
ide$date <- as.Date(ide$date)
475485
min_dt <- str_remove_all(min(ide$date, na.rm = TRUE), "-")
476486
max_dt <- str_remove_all(max(ide$date, na.rm = TRUE), "-")
477487
csv_ts <- paste(min_dt, max_dt, sep = "-")

state/id/expends/docs/id_expends_diary_2020-present.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Idaho Expenditures, 2020-present
22
================
33
Kiernan Nicholls & Yanqi Xu
4-
2024-01-01 23:20:45
4+
2024-01-07 22:23:24
55

66
- [Project](#project)
77
- [Objectives](#objectives)
@@ -712,29 +712,38 @@ glimpse(sample_n(ide, 1000))
712712

713713
## Export
714714

715+
``` r
716+
ide <- ide %>%
717+
rename_all(~str_replace(., "_swap", "_clean")) %>%
718+
select(-ends_with("city_norm")) %>%
719+
rename_all(~str_replace(., "_norm", "_clean")) %>%
720+
rename_all(~str_remove(., "_raw"))
721+
```
722+
715723
Now the file can be saved on disk for upload to the Accountability
716724
server. We will name the object using a date range of the records
717725
included.
718726

719727
``` r
728+
ide$date <- as.Date(ide$date)
720729
min_dt <- str_remove_all(min(ide$date, na.rm = TRUE), "-")
721730
max_dt <- str_remove_all(max(ide$date, na.rm = TRUE), "-")
722731
csv_ts <- paste(min_dt, max_dt, sep = "-")
723732
```
724733

725734
``` r
726-
clean_dir <- dir_create(here("id", "expends", "data", "clean"))
735+
clean_dir <- dir_create(here("state","id", "expends", "data", "clean"))
727736
clean_csv <- path(clean_dir, glue("id_expends_{csv_ts}.csv"))
728737
clean_rds <- path_ext_set(clean_csv, "rds")
729738
basename(clean_csv)
730-
#> [1] "id_expends_20200101-20231130 12:00:00.csv"
739+
#> [1] "id_expends_20200101-20231130.csv"
731740
```
732741

733742
``` r
734743
write_csv(ide, clean_csv, na = "")
735744
write_rds(ide, clean_rds, compress = "xz")
736745
(clean_size <- file_size(clean_csv))
737-
#> 32.8M
746+
#> 30.5M
738747
```
739748

740749
## Upload

0 commit comments

Comments
 (0)