-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgrantee_purpose_cols
16 lines (15 loc) · 1.2 KB
/
grantee_purpose_cols
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#OPTIONAL: CREATE "GRANTEE" AND "PURPOSE" COLUMNS
#the code below creates the grantee and purpose columns available in the downloadable CSV file available on the policy update at
#https://bit.ly/30lBJIR . These columns use the formulaic style of the bill, but are admittedly quite messy and require a fair
#amount of clean up. Or more code, that you should write and share with us! The downloadable version has been scrubbed.
bill_text<-bill_text %>%
separate(text, c("junk", "grantee", "purpose"), sep = " for ", remove = FALSE) %>% #tries to pull out project and grantee
select(article:appropriation,grantee,purpose,text)
bill_text$grantee<-str_remove_all(bill_text$grantee, "a grant to the ")
bill_text$grantee<-str_remove_all(bill_text$grantee, "the purpose of making grants and loans to ")
bill_text$grantee<-str_remove_all(bill_text$grantee, "Village of ")
bill_text$grantee<-str_remove_all(bill_text$grantee, "City of ")
bill_text$grantee<-str_remove_all(bill_text$grantee, "a grant to ")
bill_text$grantee<-str_remove_all(bill_text$grantee, "grants to ")
bill_text$grantee<-str_remove_all(bill_text$grantee, "costs associated with ")
bill_text$purpose<-str_remove_all(bill_text$purpose, "costs associated with ")