{"id":14068423,"url":"https://github.com/irworkshop/campfin","last_synced_at":"2025-10-22T05:48:39.901Z","repository":{"id":45743707,"uuid":"197235408","full_name":"irworkshop/campfin","owner":"irworkshop","description":"R package to help wrangle campaign finance data 💸","archived":false,"fork":false,"pushed_at":"2023-10-10T15:46:25.000Z","size":4001,"stargazers_count":17,"open_issues_count":2,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-02T21:50:57.229Z","etag":null,"topics":["campaign-finance","data-journalism"],"latest_commit_sha":null,"homepage":"https://irworkshop.github.io/campfin/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc-by-4.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/irworkshop.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":".github/SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-16T17:06:09.000Z","updated_at":"2024-03-29T15:49:08.000Z","dependencies_parsed_at":"2023-10-10T18:41:15.449Z","dependency_job_id":null,"html_url":"https://github.com/irworkshop/campfin","commit_stats":{"total_commits":521,"total_committers":4,"mean_commits":130.25,"dds":"0.026871401151631447","last_synced_commit":"a146c16a21b816871e9547ea51c6901432becdc1"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/irworkshop/campfin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irworkshop%2Fcampfin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irworkshop%2Fcampfin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irworkshop%2Fcampfin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irworkshop%2Fcampfin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/irworkshop","download_url":"https://codeload.github.com/irworkshop/campfin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irworkshop%2Fcampfin/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267809415,"owners_count":24147451,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["campaign-finance","data-journalism"],"created_at":"2024-08-13T07:06:09.995Z","updated_at":"2025-10-22T05:48:34.849Z","avatar_url":"https://github.com/irworkshop.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"---\noutput: github_document\nalways_allow_html: yes\neditor_options: \n  chunk_output_type: console\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, echo = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\"\n)\nif (!interactive()) {\n  options(width = 99)\n}\n```\n\n# campfin \u003cimg src=\"man/figures/logo.png\" align=\"right\" width=\"120\" /\u003e\n\n\u003c!-- badges: start --\u003e\n[![Lifecycle: maturing][life_badge]][life_link]\n[![CRAN status][cran_badge]][cran_link]\n![Downloads][dl_badge]\n[![Codecov test coverage][cov_badge]][cov_link]\n[![R build status][gh_badge]][gh_link]\n\u003c!-- badges: end --\u003e\n\nThe campfin package was created to facilitate the work being done on the \n[The Accountability Project][tap], a tool created by \n[The Investigative Reporting Workshop][irw] in Washington, DC. The\nAccountability Project curates, cleans, and indexes public data to give\njournalists, researchers and others a simple way to search across otherwise\nsiloed records. \n\nThe data focuses on people, organizations and locations. This package was\ncreated specifically to help with state-level campaign finance data, although\nthe tools included are useful in general database exploration and normalization.\n\n## Installation\n\nYou can install the released version of campfin from [CRAN][cran] with:\n\n```{r install_cran, eval=FALSE}\ninstall.packages(\"campfin\")\n```\n\nThe development version can be installed from [GitHub][gh] with:\n\n```{r install_github, eval=FALSE}\n# install.packages(\"remotes\")\nremotes::install_github(\"irworkshop/campfin\")\n```\n\n## Normalize\n\nThe package was originally built to normalize geographic data using the\n`normal_*()` functions, which take the messy self-reported geographic data of a\ncontributor, vendor, candidate, or committee and return [normalized text][txt]\nthat is more searchable. They are largely wrappers around the [stringr] package,\nand can call other sub-functions to streamline normalization.\n\n* `normal_address()` takes a _street_ address and reduces inconsistencies.\n* `normal_zip()` takes [ZIP Codes][zip] and aims to return a valid 5-digit code.\n* `normal_state()` takes US states and returns a [2 digit abbreviation][abbs].\n* `normal_city()` takes cities and reduces inconsistencies.\n* `normal_phone()` consistently formats US telephone numbers.\n\nPlease see the vignette on normalization for an example of how these functions\nare used to fix a wide variety of string inconsistencies and make campaign \nfinance data more consistent.\n\n## Data\n\n```{r library, message=FALSE, warning=FALSE}\nlibrary(campfin)\nlibrary(tidyverse)\n```\n\nThe campfin package contains a number of built in data frames and strings used\nto help wrangle campaign finance data.\n\nThe `/data-raw` directory contains the code used to create the objects.\n\n### zipcodes\n\nThe `zipcodes` (plural) table is a new version of the `zipcode` (singular) table\nfrom the archived [zipcode] R package.\n\n\u003e This database was composed using ZIP code gazetteers from the US Census Bureau\nfrom 1999 and 2000, augmented with additional ZIP code information The database\nis believed to contain over 98% of the ZIP Codes in current use in the United\nStates. The remaining ZIP Codes absent from this database are entirely PO Box or\nFirm ZIP codes added in the last five years, which are no longer published by\nthe Census Bureau, but in any event serve a very small minority of the\npopulation (probably on the order of .1% or less). Although every attempt has\nbeen made to filter them out, this data set may contain up to .5% false\npositives, that is, ZIP codes that do not exist or are no longer in use but are\nincluded due to erroneous data sources.\n\nThe included `valid_city` and `valid_zip` vectors are sorted, unique columns\nfrom the `zipcodes` data frame.\n\n```{r geo_df, collapse=TRUE, warning=FALSE, message=FALSE, error=FALSE}\nsample_frac(zipcodes)\n```\n\n### `usps_*` and `valid_*`\n\nThe `usps_*` data frames were scraped from the official United States Postal\nService (USPS) [Postal Addressing Standards][pub]. These data frames are\ndesigned to work with the abbreviation functionality of `normal_address()` and\n`normal_city()` to replace common abbreviations with their full equivalent.\n\n`usps_city` is a curated subset of `usps_state`, whose full version appear at\nleast once in the `valid_city` vector from `zipcodes`. The `valid_state` and\n`valid_name` vectors contain the columns from `usps_state` and include\nterritories not found in R's build in `state.abb` and `state.name` vectors.\n\n```{r usps}\nsample_n(usps_street, 3)\nsample_n(usps_state, 3)\nsetdiff(valid_state, state.abb)\n```\n\n*****\n\nThe campfin project is released with a [Contributor Code of Conduct][coc]. By\ncontributing, you agree to abide by its terms.\n\n\u003c!-- refs: start --\u003e\n[life_badge]: https://img.shields.io/badge/lifecycle-maturing-blue.svg\n[life_link]: https://lifecycle.r-lib.org/articles/stages.html\n[cran_badge]: https://www.r-pkg.org/badges/version/campfin\n[cran_link]: https://CRAN.R-project.org/package=campfin\n[dl_badge]: https://cranlogs.r-pkg.org/badges/grand-total/campfin\n[cov_badge]: https://img.shields.io/codecov/c/github/irworkshop/campfin/master.svg\n[cov_link]: https://app.codecov.io/gh/irworkshop/campfin?branch=master\n[gh_badge]: https://github.com/irworkshop/campfin/workflows/R-CMD-check/badge.svg\n[gh_link]: https://github.com/irworkshop/campfin/actions\n[tap]: https://www.publicaccountability.org/\n[irw]: https://investigativereportingworkshop.org/\n[fin]: https://en.wikipedia.org/wiki/Campaign_finance\n[cran]: https://cran.r-project.org/package=campfin\n[gh]: https://github.com/irworkshop/campfin\n[tidyverse]: https://www.tidyverse.org/\n[txt]: https://en.wikipedia.org/wiki/Text_normalization\n[stringr]: https://github.com/tidyverse/stringr\n[zip]: https://en.wikipedia.org/wiki/ZIP_Code \n[abbs]: https://en.wikipedia.org/wiki/List_of_U.S._state_abbreviations\n[zipcode]: https://cran.r-project.org/src/contrib/Archive/zipcode/\n[pub]: https://pe.usps.com/text/pub28/28apc_002.htm\n[coc]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html\n\u003c!-- refs: end --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firworkshop%2Fcampfin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Firworkshop%2Fcampfin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firworkshop%2Fcampfin/lists"}