From def91d4d6798bfb2e6e4ac8e00acfab8c77a07fb Mon Sep 17 00:00:00 2001 From: donboyd5 Date: Wed, 30 Oct 2024 06:34:29 -0400 Subject: [PATCH 01/24] Add R files to prepare folder --- tmd/areas/targets/prepare/R/constants.R | 10 ++++ tmd/areas/targets/prepare/R/libraries.R | 77 +++++++++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 tmd/areas/targets/prepare/R/constants.R create mode 100644 tmd/areas/targets/prepare/R/libraries.R diff --git a/tmd/areas/targets/prepare/R/constants.R b/tmd/areas/targets/prepare/R/constants.R new file mode 100644 index 00000000..477d50c5 --- /dev/null +++ b/tmd/areas/targets/prepare/R/constants.R @@ -0,0 +1,10 @@ + +CDZIPURL <- "https://www.irs.gov/pub/irs-soi/congressional2021.zip" +CDDOCURL <- "https://www.irs.gov/pub/irs-soi/21incddocguide.docx" + +CDDIR <- here::here("cds") +CDRAW <- fs::path(CDDIR, "raw_data") +CDINTERMEDIATE <- fs::path(CDDIR, "intermediate") +CDFINAL <- fs::path(CDDIR, "final") + +CDDOCEXTRACT <- "cd_documentation_extracted_from_21incddocguide.docx.xlsx" diff --git a/tmd/areas/targets/prepare/R/libraries.R b/tmd/areas/targets/prepare/R/libraries.R new file mode 100644 index 00000000..8b97d47f --- /dev/null +++ b/tmd/areas/targets/prepare/R/libraries.R @@ -0,0 +1,77 @@ +# libraries --------------------------------------------------------------- + +library(DT) +library(fs) +library(gt) +library(knitr) +library(readxl) +library(skimr) +library(stringr) +library(tidyverse) +# includes: dplyr, forcats, ggplot2, lubridate, purrr, stringr, tibble, tidyr + +tprint <- 75 # default tibble print +options(tibble.print_max = tprint, tibble.print_min = tprint) # show up to tprint rows + +# census_api_key("b27cb41e46ffe3488af186dd80c64dce66bd5e87", install = TRUE) # stored in .Renviron +# libraries needed for census population +library(sf) +library(tidycensus) +library(tigris) +options(tigris_use_cache = TRUE) + + +# possible libraries ------------------------------------------------------ + +# library(rlang) +# library(tidyverse) +# tprint <- 75 # default tibble print +# options(tibble.print_max = tprint, tibble.print_min = tprint) # show up to tprint rows +# +# library(fs) + +# tools +# library(vroom) +# library(readxl) +# library(openxlsx) # for writing xlsx files +# library(lubridate) +# library(RColorBrewer) +# library(RcppRoll) +# library(fredr) +# library(tidycensus) +# library(googledrive) +# library(arrow) +# +# library(jsonlite) +# library(tidyjson) +# +# +# # boyd libraries +# # library(btools) +# # library(bdata) +# # library(bggtools) +# # library(bmaps) +# +# # graphics +# library(scales) +# library(ggbeeswarm) +# library(patchwork) +# library(gridExtra) +# library(ggrepel) +# library(ggbreak) +# +# # tables +# library(knitr) +# library(kableExtra) +# library(DT) +# library(gt) +# library(gtExtras) +# library(janitor) +# library(skimr) +# library(vtable) +# +# # maps +# library(maps) +# # https://cran.r-project.org/web/packages/usmap/vignettes/mapping.html +# library(usmap) + From d9feacbcccec2c5663f657f6e8615cc805a728dd Mon Sep 17 00:00:00 2001 From: donboyd5 Date: Thu, 31 Oct 2024 04:56:23 -0400 Subject: [PATCH 02/24] update introductory text --- tmd/areas/targets/prepare/index.qmd | 4 +++- tmd/areas/targets/prepare/usage.qmd | 11 +++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/tmd/areas/targets/prepare/index.qmd b/tmd/areas/targets/prepare/index.qmd index de14053a..60c194fe 100644 --- a/tmd/areas/targets/prepare/index.qmd +++ b/tmd/areas/targets/prepare/index.qmd @@ -6,10 +6,12 @@ editor_options: # Introduction -The R project in the tax-microdata-benchmarking folder "tmd/areas/targets/prepare/" constructs subnational area targets for: +This R project constructs subnational area targets for: - States (to come) - Congressional districts (in progress) In addition, it creates a local web page that a user can upload to a web service if desired. An in-progress version can be viewed on the web [here](https://tmd-areas-prepare-targets.netlify.app/). During development, it may not be identical to what your clone creates. + +It is part of the larger tax-microdata-benchmarking project, and is in the subfolder "tmd/areas/targets/prepare/". diff --git a/tmd/areas/targets/prepare/usage.qmd b/tmd/areas/targets/prepare/usage.qmd index 41aff624..1e581c83 100644 --- a/tmd/areas/targets/prepare/usage.qmd +++ b/tmd/areas/targets/prepare/usage.qmd @@ -16,20 +16,15 @@ editor_options: - Be sure that ".../targets/prepare/cds/raw_data/" exists and has the following files: - - - - - ![](images/raw_data.jpeg) -## To build the web page and create target files +## To create target files and build the web page - Open a terminal in the "prepare" folder. - Enter "quarto render" @@ -37,12 +32,12 @@ editor_options: ## After rendering is complete - target .csv files will be in the ".../targets/prepare/cds/final/" folder -- local documentation web page will be in the ".../targets/prepare/\_targetprep/" folder +- local documentation web page will be in the ".../targets/prepare/_targetprep/" folder ## To create area weights using the target files in tax-microdata-benchmarking - copy desired target .csv files from ".../targets/prepare/cds/final/" folder to the ".../targets/" folder -- follow tax-microdata-benchmarking instructions to run `make_all.py` or \`create_area_weights.py' +- follow tax-microdata-benchmarking instructions to run `make_all.py` or `create_area_weights.py' ## Additional notes From 4d48c32903e586ada3a2a0a0d87c4bfb4bea33fe Mon Sep 17 00:00:00 2001 From: donboyd5 Date: Thu, 31 Oct 2024 05:10:47 -0400 Subject: [PATCH 03/24] update population documentation --- .../targets/prepare/cd_get_census_population.qmd | 12 +++++++----- tmd/areas/targets/prepare/cd_issues_and_TODOs.qmd | 1 - 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/tmd/areas/targets/prepare/cd_get_census_population.qmd b/tmd/areas/targets/prepare/cd_get_census_population.qmd index cbec8c94..21df2a6f 100644 --- a/tmd/areas/targets/prepare/cd_get_census_population.qmd +++ b/tmd/areas/targets/prepare/cd_get_census_population.qmd @@ -18,9 +18,12 @@ source(here::here("R", "constants.R")) ``` - ## Get Congressional District population +The quarto chunk `cdpop-download` will, if a user sets the chunk `eval` option to `eval: true`, download and save Congressional District population data from the American Community Survey (ACS) for 2021 and for the 5-year period ending in 2021, based on the 116th Congress. + +Ordinarlily this will not be necessary because previously downloaded files are included with the project in the "../cds/raw_data" folder. Thus, the default chunk option is `eval: false` and the chunk will not be run when this project is rendered. + ```{r} #| label: cdpop-download #| eval: false @@ -47,11 +50,13 @@ write_csv(cdpop1year, fs::path(CDRAW, "cdpop1year_acs.csv")) ## Clean Congressional District population +This chunk gets previously saved Congressional District population data, does minor cleaning, and saves the cleaned file to the "../cds/intermediate" folder + ```{r} #| label: cdpop-clean cdpop1year <- read_csv(fs::path(CDRAW, "cdpop1year_acs.csv")) -cdpop5year <- read_csv(fs::path(CDRAW, "cdpop5year_acs.csv")) +# cdpop5year <- read_csv(fs::path(CDRAW, "cdpop5year_acs.csv")) cdpop1year |> summarise(estimate=sum(estimate)) # 335157329 cdpop5year |> summarise(estimate=sum(estimate)) # 333036755 @@ -89,6 +94,3 @@ write_csv(cdpop1, fs::path(CDINTERMEDIATE, "cdpop1year.csv")) ``` - - - diff --git a/tmd/areas/targets/prepare/cd_issues_and_TODOs.qmd b/tmd/areas/targets/prepare/cd_issues_and_TODOs.qmd index 418a8c5c..7a76a0f4 100644 --- a/tmd/areas/targets/prepare/cd_issues_and_TODOs.qmd +++ b/tmd/areas/targets/prepare/cd_issues_and_TODOs.qmd @@ -4,7 +4,6 @@ editor_options: chunk_output_type: console --- - # Issues and TODOs ### Investigate collapsed AGI ranges in the SOI data From 49749bcaa81b52720b4cee1989a9d73d889d7a63 Mon Sep 17 00:00:00 2001 From: donboyd5 Date: Thu, 31 Oct 2024 05:13:46 -0400 Subject: [PATCH 04/24] better population file names --- tmd/areas/targets/prepare/_quarto.yml | 2 +- ...ion.qmd => cd_download_and_clean_census_population_data.qmd} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename tmd/areas/targets/prepare/{cd_get_census_population.qmd => cd_download_and_clean_census_population_data.qmd} (100%) diff --git a/tmd/areas/targets/prepare/_quarto.yml b/tmd/areas/targets/prepare/_quarto.yml index ce2bd4e6..0534d8c8 100644 --- a/tmd/areas/targets/prepare/_quarto.yml +++ b/tmd/areas/targets/prepare/_quarto.yml @@ -42,7 +42,7 @@ book: - part: "IRS Congressional District data" chapters: - cd_overall_documentation.qmd - - cd_get_census_population.qmd + - cd_download_and_clean_census_population_data.qmd - cd_download_soi_data.qmd - cd_construct_variable_documentation.qmd - cd_construct_long_soi_data_file.qmd diff --git a/tmd/areas/targets/prepare/cd_get_census_population.qmd b/tmd/areas/targets/prepare/cd_download_and_clean_census_population_data.qmd similarity index 100% rename from tmd/areas/targets/prepare/cd_get_census_population.qmd rename to tmd/areas/targets/prepare/cd_download_and_clean_census_population_data.qmd From 4b68e6a9c55fdf551da34a56cb1652f9a78a7c89 Mon Sep 17 00:00:00 2001 From: donboyd5 Date: Thu, 31 Oct 2024 05:26:25 -0400 Subject: [PATCH 05/24] update soi download documentation --- .../targets/prepare/cd_download_soi_data.qmd | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/tmd/areas/targets/prepare/cd_download_soi_data.qmd b/tmd/areas/targets/prepare/cd_download_soi_data.qmd index e6b38e1a..36c73080 100644 --- a/tmd/areas/targets/prepare/cd_download_soi_data.qmd +++ b/tmd/areas/targets/prepare/cd_download_soi_data.qmd @@ -4,9 +4,19 @@ editor_options: chunk_output_type: console --- -# Download Congressional District data and documentation files +# Download SOI Congressional District data and documentation files -NOTE: To download data, change eval: to true in the header of the downloads chunk. Otherwise, this program assumes data already have been downloaded. +SOI Congressional District data and documentation files are included with the project in the "../cds/raw_data" folder and by default, rendering the project will NOT re-download the data. + +To re-download data and save to the "../cds/raw_data" folder, set option `eval: true` in the `downloads` chunk below + +## File locations on the web + +- [SOI Congressional Districts landing page](https://www.irs.gov/statistics/soi-tax-stats-data-by-congressional-district) + + - [2021 folder](https://www.irs.gov/statistics/soi-tax-stats-data-by-congressional-district-2021) + - [zip archive with all data files](https://www.irs.gov/pub/irs-soi/congressional2021.zip) + - [Word documentation](https://www.irs.gov/pub/irs-soi/21incddocguide.docx) ## Setup @@ -19,12 +29,9 @@ source(here::here("R", "constants.R")) ``` -## Download CD data and documentation if not already downloaded - -- [SOI Congressional Districts landing page](https://www.irs.gov/statistics/soi-tax-stats-data-by-congressional-district) - - - [2021 folder](https://www.irs.gov/statistics/soi-tax-stats-data-by-congressional-district-2021) +## (Optionally) Download SOI CD data and documentation +As noted, by default, the files will NOT be downloaded when the project is rendered. ```{r} #| label: downloads From 430db5b80c91963d67d97735f8e610ca47be07af Mon Sep 17 00:00:00 2001 From: donboyd5 Date: Thu, 31 Oct 2024 05:41:19 -0400 Subject: [PATCH 06/24] Updated documentation on how we computerize variable documentation --- .../cd_construct_variable_documentation.qmd | 44 ++++++++++++------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/tmd/areas/targets/prepare/cd_construct_variable_documentation.qmd b/tmd/areas/targets/prepare/cd_construct_variable_documentation.qmd index 9ffe8466..4beb5069 100644 --- a/tmd/areas/targets/prepare/cd_construct_variable_documentation.qmd +++ b/tmd/areas/targets/prepare/cd_construct_variable_documentation.qmd @@ -4,19 +4,7 @@ editor_options: chunk_output_type: console --- - -# Parse and show Congressional District data documentation - -Note that we do not have number of exemptions, but we do have: - -- N1 -- number of returns - -- N2 -- number of individuals - -Footnote 5 in the IRS documentation file (21incddocguide.docx), pertaining to N2, says: - -> Beginning in 2018, personal exemption deductions were suspended for the primary, secondary, and dependent taxpayers. However, the data used to create the “Number of individuals”—filing status, dependent status indicator, and identifying dependent information—are still available on the Form 1040. This field is based on these data. - +# Parse and show SOI Congressional District data documentation ## Setup @@ -31,12 +19,18 @@ source(here::here("R", "constants.R")) ## Parse and save variable documentation +This section gets and cleans SOI variable documentation from an Excel file we created, "cd_documentation_extracted_from_21incddocguide.docx.xlsx" that is based on a table in SOI's Word documentation (21incddocguide.docx). + +We put the cleaned data in "variable_documentation.csv" in the "../cds/intermediate" folder. + + ```{r} #| label: parse-save-doc #| output: false doc1 <- read_excel(fs::path(CDRAW, CDDOCEXTRACT), sheet = "cleaned", range = "A2:D169") +# clean SOI documentation and doc2 <- doc1 |> mutate( across(everything(), @@ -83,6 +77,7 @@ rm(doc1, doc2, doc3) ``` +Project team members run this next chunk interactively to do some checks on the variable documentation. It has option `eval: false` and will not be run when the project is rendered. ```{r} #| label: check-doc @@ -115,9 +110,9 @@ rm(amountvars, countvars) ``` -## Show variable documentation +## Show variable documentation in a datatable -Show documentation table for variables in the Congressional District csv data. +Show documentation table for variables in the Congressional District csv data. The table can be filtered and sorted interactively using column headers. ```{r} #| label: show-doc @@ -136,3 +131,22 @@ vdoc |> rm(vdoc) ``` + +## Issues and notes + +Notes below are primarily intended for the project team but could be of interest to users. + +### Number of returns and number of individuals + +Note that we do not have number of exemptions, but we do have: + +- N1 -- number of returns + +- N2 -- number of individuals + +Footnote 5 in the IRS documentation file (21incddocguide.docx), pertaining to N2, says: + +> Beginning in 2018, personal exemption deductions were suspended for the primary, secondary, and dependent taxpayers. However, the data used to create the “Number of individuals”—filing status, dependent status indicator, and identifying dependent information—are still available on the Form 1040. This field is based on these data. + + + From d507924819a525067b54d691496cf2eb4b9205ce Mon Sep 17 00:00:00 2001 From: donboyd5 Date: Thu, 31 Oct 2024 05:42:48 -0400 Subject: [PATCH 07/24] soi documentation development file rename --- tmd/areas/targets/prepare/_quarto.yml | 2 +- ...entation.qmd => cd_construct_soi_variable_documentation.qmd} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename tmd/areas/targets/prepare/{cd_construct_variable_documentation.qmd => cd_construct_soi_variable_documentation.qmd} (100%) diff --git a/tmd/areas/targets/prepare/_quarto.yml b/tmd/areas/targets/prepare/_quarto.yml index 0534d8c8..95f18eeb 100644 --- a/tmd/areas/targets/prepare/_quarto.yml +++ b/tmd/areas/targets/prepare/_quarto.yml @@ -44,7 +44,7 @@ book: - cd_overall_documentation.qmd - cd_download_and_clean_census_population_data.qmd - cd_download_soi_data.qmd - - cd_construct_variable_documentation.qmd + - cd_construct_soi_variable_documentation.qmd - cd_construct_long_soi_data_file.qmd - cd_create_basefile_for_cd_target_files.qmd - cd_create_crosswalk_from_cd117th_to_cd118th.qmd diff --git a/tmd/areas/targets/prepare/cd_construct_variable_documentation.qmd b/tmd/areas/targets/prepare/cd_construct_soi_variable_documentation.qmd similarity index 100% rename from tmd/areas/targets/prepare/cd_construct_variable_documentation.qmd rename to tmd/areas/targets/prepare/cd_construct_soi_variable_documentation.qmd From cd8be18465028260dab38f926cb45152def17b64 Mon Sep 17 00:00:00 2001 From: donboyd5 Date: Thu, 31 Oct 2024 05:50:07 -0400 Subject: [PATCH 08/24] unnumber introduction page --- tmd/areas/targets/prepare/index.qmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmd/areas/targets/prepare/index.qmd b/tmd/areas/targets/prepare/index.qmd index 60c194fe..bc4e2029 100644 --- a/tmd/areas/targets/prepare/index.qmd +++ b/tmd/areas/targets/prepare/index.qmd @@ -4,7 +4,7 @@ editor_options: chunk_output_type: console --- -# Introduction +# Introduction {.unnumbered} This R project constructs subnational area targets for: From d847d93c2cc6ea4453008bb000692c060f5fb9ec Mon Sep 17 00:00:00 2001 From: donboyd5 Date: Thu, 31 Oct 2024 05:57:19 -0400 Subject: [PATCH 09/24] comment out 5-year ACS code --- tmd/areas/targets/prepare/.gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tmd/areas/targets/prepare/.gitignore b/tmd/areas/targets/prepare/.gitignore index 8bbfdf6d..c4007581 100644 --- a/tmd/areas/targets/prepare/.gitignore +++ b/tmd/areas/targets/prepare/.gitignore @@ -13,3 +13,5 @@ _freeze/ # Local Netlify folder .netlify + +/.quarto/ From d8806d1802df1779e51b3fa6027d55e9c35420a4 Mon Sep 17 00:00:00 2001 From: donboyd5 Date: Thu, 31 Oct 2024 06:04:43 -0400 Subject: [PATCH 10/24] update soi long file documentation --- .../targets/prepare/cd_construct_long_soi_data_file.qmd | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tmd/areas/targets/prepare/cd_construct_long_soi_data_file.qmd b/tmd/areas/targets/prepare/cd_construct_long_soi_data_file.qmd index f981cbb7..39be622e 100644 --- a/tmd/areas/targets/prepare/cd_construct_long_soi_data_file.qmd +++ b/tmd/areas/targets/prepare/cd_construct_long_soi_data_file.qmd @@ -6,7 +6,7 @@ editor_options: # Parse the Congressional District data -Clean the CD data and save. +Clean the SOI Congressional District data and save. ## Setup @@ -30,6 +30,8 @@ Here is an example of the first few rows of a targets file: ## Create AGI stub information +Create AGI bin labels that map to the AGI bins that SOI uses. + ```{r} #| label: agi-bins @@ -168,7 +170,7 @@ rm(data, data2, cdnums) ```{r} #| label: create-save-soi-cddata-long -#| eval: false +#| eval: true cdwide <- read_csv(fs::path(CDINTERMEDIATE, "cddata_wide_clean.csv")) doc <- read_csv(fs::path(CDINTERMEDIATE, "variable_documentation.csv")) From 59dac0244f02a80bd1e96a78ae99a803eca5768b Mon Sep 17 00:00:00 2001 From: donboyd5 Date: Thu, 31 Oct 2024 06:04:55 -0400 Subject: [PATCH 11/24] move appendix --- tmd/areas/targets/prepare/_quarto.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tmd/areas/targets/prepare/_quarto.yml b/tmd/areas/targets/prepare/_quarto.yml index 95f18eeb..a41edbcc 100644 --- a/tmd/areas/targets/prepare/_quarto.yml +++ b/tmd/areas/targets/prepare/_quarto.yml @@ -39,9 +39,8 @@ book: chapters: - usage.qmd - cd_issues_and_TODOs.qmd - - part: "IRS Congressional District data" + - part: "IRS SOI Congressional District data" chapters: - - cd_overall_documentation.qmd - cd_download_and_clean_census_population_data.qmd - cd_download_soi_data.qmd - cd_construct_soi_variable_documentation.qmd @@ -49,6 +48,8 @@ book: - cd_create_basefile_for_cd_target_files.qmd - cd_create_crosswalk_from_cd117th_to_cd118th.qmd - cd_map_tcvars_and_extract_target_files.qmd + appendices: + - cd_overall_documentation.qmd format: html: From b8995a5047b50f1205c7bde26b0888e382000ba7 Mon Sep 17 00:00:00 2001 From: donboyd5 Date: Thu, 31 Oct 2024 06:05:27 -0400 Subject: [PATCH 12/24] comment-out code for ACS 5-year population --- .../prepare/cd_download_and_clean_census_population_data.qmd | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tmd/areas/targets/prepare/cd_download_and_clean_census_population_data.qmd b/tmd/areas/targets/prepare/cd_download_and_clean_census_population_data.qmd index 21df2a6f..c382e5c0 100644 --- a/tmd/areas/targets/prepare/cd_download_and_clean_census_population_data.qmd +++ b/tmd/areas/targets/prepare/cd_download_and_clean_census_population_data.qmd @@ -56,11 +56,10 @@ This chunk gets previously saved Congressional District population data, does mi #| label: cdpop-clean cdpop1year <- read_csv(fs::path(CDRAW, "cdpop1year_acs.csv")) -# cdpop5year <- read_csv(fs::path(CDRAW, "cdpop5year_acs.csv")) - cdpop1year |> summarise(estimate=sum(estimate)) # 335157329 -cdpop5year |> summarise(estimate=sum(estimate)) # 333036755 +# cdpop5year <- read_csv(fs::path(CDRAW, "cdpop5year_acs.csv")) +# cdpop5year |> summarise(estimate=sum(estimate)) # 333036755 stcodes <- tigris::states() |> as.data.frame() |> From 835ba83d54970a4bd83f3043cfa1979b3661ab34 Mon Sep 17 00:00:00 2001 From: donboyd5 Date: Thu, 31 Oct 2024 06:20:38 -0400 Subject: [PATCH 13/24] move data description to appendix --- tmd/areas/targets/prepare/_quarto.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmd/areas/targets/prepare/_quarto.yml b/tmd/areas/targets/prepare/_quarto.yml index a41edbcc..3f3e8c0e 100644 --- a/tmd/areas/targets/prepare/_quarto.yml +++ b/tmd/areas/targets/prepare/_quarto.yml @@ -38,7 +38,6 @@ book: - part: "Usage and notes" chapters: - usage.qmd - - cd_issues_and_TODOs.qmd - part: "IRS SOI Congressional District data" chapters: - cd_download_and_clean_census_population_data.qmd @@ -49,6 +48,7 @@ book: - cd_create_crosswalk_from_cd117th_to_cd118th.qmd - cd_map_tcvars_and_extract_target_files.qmd appendices: + - cd_issues_and_TODOs.qmd - cd_overall_documentation.qmd format: From 3bd444b80290c75a3a115a552ce086ad92eb61d3 Mon Sep 17 00:00:00 2001 From: donboyd5 Date: Thu, 31 Oct 2024 06:21:13 -0400 Subject: [PATCH 14/24] separate IRS documentation from my comments on IRS data --- .../targets/prepare/cd_issues_and_TODOs.qmd | 41 +++++++++++--- .../prepare/cd_overall_documentation.qmd | 53 +++---------------- 2 files changed, 42 insertions(+), 52 deletions(-) diff --git a/tmd/areas/targets/prepare/cd_issues_and_TODOs.qmd b/tmd/areas/targets/prepare/cd_issues_and_TODOs.qmd index 7a76a0f4..bbfb7b9b 100644 --- a/tmd/areas/targets/prepare/cd_issues_and_TODOs.qmd +++ b/tmd/areas/targets/prepare/cd_issues_and_TODOs.qmd @@ -4,17 +4,17 @@ editor_options: chunk_output_type: console --- -# Issues and TODOs +# Congressional District data issues and TODOs -### Investigate collapsed AGI ranges in the SOI data +## Investigate collapsed AGI ranges in the SOI data - Per IRS documentation: "Income and tax items with less than 20 returns for a particular AGI class were combined with another AGI class within the same congressional district. Collapsed AGI classes are identified with a double asterisk (dropped) in the Excel files." **This will require attention soon.** -### Defining number of returns with AGI +## Defining number of returns with AGI - We have an issue with AGI: for Congressional Districts IRS does NOT report the number of returns with AGI. They report two variables that should be close in concept: N1 (Number of returns), and N02650 (Number of returns with total income). For all CDs in the U.S. N1 was 157,375,370 in 2021 and N02650 was 155,283,590. Since N1 is larger and is probably a better indicator of total number of filers, we'll use that as the number-of-returns counterpart to AGI (c00100). We address this late in the process because for most of the data development we try to keep the data faithful to what IRS reports and because the solution chosen here may be suboptimal and we may want to change it later. -### Census population +## Census population Used to create the row 0 "XTOT" (population) target as a way to develop an initial scaling ratio: `initial_weights_scale = row.target / national_population`. @@ -22,11 +22,11 @@ Used to create the row 0 "XTOT" (population) target as a way to develop an initi - 2021 was a strange year for population data because of Covid. It might be better to use the 5-year ACS ending in 2021 for more stable and representative data. -### Estimate targets for 118th Congress district boundaries weighting by population weights +## Estimate targets for 118th Congress district boundaries weighting by population weights - Use already-created population crosswalk from Missouri Census Data Center to allocate 117th Congress district targets to 118th Congress districts. See [MCDC site](https://mcdc.missouri.edu/applications/geocorr2022.html). -### Address SALT deductions +## Address SALT deductions Two possible approaches: @@ -34,3 +34,32 @@ Two possible approaches: - Add TMD 2021 "c" variables to the optimization cache. Map these variables to SOI variables based on their share of corresponding SOI amounts among all CDs. Requires modifying the cache in create_area_weights.py. + +## Determining which records are Congressional District records + +- Calculate nstub0 -- number of records by state where AGI_STUB == 0 (the totals record) +- Note that CONG_DISTRICT == "00" is a totals record for the state. There are 8 states that only have 1 CD (see IRS documentation above), and for those states this record doubles as a CD record and as the state record. +- Determine type of record: + - US -- STATE == "US" + - DC -- STATE == "DC" + - state -- nstub0 \> 1 & CONG_DISTRICT == "00" + - cdstate -- nstub0 == 1 (this is both a state record and a CD record, for 8 states) + - cd -- nstub0 \> 1 & CONG_DISTRICT != "00" + +The cd and cdstate records have data for Congressional Districts. There are 435 of these for AGI_STUB == 0 - one for each voting Congressional District (not including the District of Columbia). SOI data also have records for the nonvoting DC district. It is not included in the 435 Congressional Districts . + +The state and cdstate records have data for states. There are 51 of these (4) + +![](images/clipboard-719051713.png) + +To verify that this produces a proper calculation of the number of districts by state, I asked ChatGPT (4o) the following question, and compared the results by state to the calculation above. They are the same. + +> Please give me a table of the number of congressional districts by state (plus the District of Columbia), based on the 117th Congress, ideally as a google sheet or exportable to a spreadsheet. It should have 3 columns: state postal abbreviation, state name, and number of districts. It should add to 435 districts, I believe. + +## Exemptions + +Note that there are no data on exemptions but we do have total number of individuals (N2). + +When run on 2024-10-12 tmd national population was 334,283,385 (\`national_population = (vardf.s006 \* vardf.XTOT).sum()\`). By contrast, the sum of N2 for the U.S. was 289,054,220, or 13.5% less, according to 21incdall.xlsx. + +FWIW, IRS total number of returns in was 160,824,340 per 21in14ar.xls. When run on 2024-10-12 tmd sum of s006 was 184,024,657, or 14.4% more. By contrast, the sum of N1 for the U.S. was 157,375,370, or 2.1% less, according to 21incdall.xlsx. diff --git a/tmd/areas/targets/prepare/cd_overall_documentation.qmd b/tmd/areas/targets/prepare/cd_overall_documentation.qmd index 48058751..3a57544d 100644 --- a/tmd/areas/targets/prepare/cd_overall_documentation.qmd +++ b/tmd/areas/targets/prepare/cd_overall_documentation.qmd @@ -4,23 +4,15 @@ editor_options: chunk_output_type: console --- -# About the data +# About the SOI Congressional District data -This chapter has two sections: +All text in this section is copied verbatim from the IRS SOI data documentation (21incddocguide.docx), with no substantive edits and no commentary. -- IRS documentation: Copied verbatim from the IRS SOI data documentation (21incddocguide.docx), with no substantive edits and no commentary. - -- Comments on the data: Notes about selected issues, quirks, and pitfalls in the data discovered from working with the data. - -## IRS documentation - -All text in this section is a direct quote from IRS documentation. - -### Time period +## Time period The Statistics of Income (SOI) Division’s Congressional district data is tabulated using individual income tax returns (Forms 1040) filed with the Internal Revenue Service (IRS) during the 12-month period, January 1, 2022 to December 31, 2022. While the bulk of returns filed during this 12-month period are primarily for Tax Year 2021, the IRS received a limited number of returns for tax years before 2021. These prior-year returns are used as a proxy for returns that are typically filed beyond the 12-month period and have been included within the congressional district data. -### Population Definitions and Tax Return Addresses +## Population Definitions and Tax Return Addresses - Congressional data are based on the population of individual income tax returns processed by the IRS during the 2022 calendar year. @@ -38,7 +30,7 @@ The Statistics of Income (SOI) Division’s Congressional district data is tabul - Tax returns filed using Army Post Office (APO) and Fleet Post Office addresses, foreign addresses, and addresses in Puerto Rico, Guam, Virgin Islands, American Samoa, Marshall Islands, Northern Marianas, and Palau were excluded. -### Congressional District and ZIP Code Matching Procedures +## Congressional District and ZIP Code Matching Procedures SOI uses a commercial file to match ZIP codes to congressional districts. Congressional districts cover the 435 congressional districts in the 50 states and the District of Columbia. District boundaries are based on the 117th Congress. @@ -46,7 +38,7 @@ The matching process first utilizes the 9-digit ZIP code, if present on the retu Eight states (AK, DC, DE, MT, ND, SD, VT, and WY) have only one congressional district, therefore the matching procedures are not performed on these states. Returns with only one congressional district represent 2 percent of the total number of returns. -### Disclosure Protection Procedures +## Disclosure Protection Procedures SOI did not attempt to correct any ZIP codes listed on the tax returns; however, it did take the following precautions to avoid disclosing information about specific taxpayers: @@ -56,7 +48,7 @@ SOI did not attempt to correct any ZIP codes listed on the tax returns; however, - If an income or tax item from one return constitutes more than a specified percentage of the total of any particular cell, the specific data item for that return is excluded from that cell. For example, if the amount for wages from one return represents 75 percent of the value of the total for that cell, the data item will be suppressed. The actual threshold percentage used cannot be released. -### IRS Endnotes +## IRS Endnotes [1] The use of prior-year returns as a proxy for returns that are filed beyond the current processing year is consistent with SOI’s national, state, county, and ZIP code tabulations. A description of SOI’s sample, which is used as an input for the geographic data, and the use of prior-year returns, can be found at https://www.irs.gov/statistics/soi-tax-stats-individual-income-tax-returns-publication-1304-complete-report#_sec2. @@ -106,34 +98,3 @@ An advance refund of the 2021 recovery rebate credit made under section 6428B of [21] The amount of overpayments the tax filer requested to have refunded. - -## Comments on the data - -### Determining which records are Congressional District records - -- Calculate nstub0 -- number of records by state where AGI_STUB == 0 (the totals record) -- Note that CONG_DISTRICT == "00" is a totals record for the state. There are 8 states that only have 1 CD (see IRS documentation above), and for those states this record doubles as a CD record and as the state record. -- Determine type of record: - - US -- STATE == "US" - - DC -- STATE == "DC" - - state -- nstub0 \> 1 & CONG_DISTRICT == "00" - - cdstate -- nstub0 == 1 (this is both a state record and a CD record, for 8 states) - - cd -- nstub0 \> 1 & CONG_DISTRICT != "00" - -The cd and cdstate records have data for Congressional Districts. There are 435 of these for AGI_STUB == 0 - one for each voting Congressional District (not including the District of Columbia). SOI data also have records for the nonvoting DC district. It is not included in the 435 Congressional Districts . - -The state and cdstate records have data for states. There are 51 of these (4) - -![](images/clipboard-719051713.png) - -To verify that this produces a proper calculation of the number of districts by state, I asked ChatGPT (4o) the following question, and compared the results by state to the calculation above. They are the same. - -> Please give me a table of the number of congressional districts by state (plus the District of Columbia), based on the 117th Congress, ideally as a google sheet or exportable to a spreadsheet. It should have 3 columns: state postal abbreviation, state name, and number of districts. It should add to 435 districts, I believe. - -### Exemptions - -Note that there are no data on exemptions but we do have total number of individuals (N2). - -When run on 2024-10-12 tmd national population was 334,283,385 (\`national_population = (vardf.s006 \* vardf.XTOT).sum()\`). By contrast, the sum of N2 for the U.S. was 289,054,220, or 13.5% less, according to 21incdall.xlsx. - -FWIW, IRS total number of returns in was 160,824,340 per 21in14ar.xls. When run on 2024-10-12 tmd sum of s006 was 184,024,657, or 14.4% more. By contrast, the sum of N1 for the U.S. was 157,375,370, or 2.1% less, according to 21incdall.xlsx. From 846ad090369878cfb7c20c3f7c987d28768f6f13 Mon Sep 17 00:00:00 2001 From: donboyd5 Date: Thu, 31 Oct 2024 06:33:53 -0400 Subject: [PATCH 15/24] better documentation of usage --- tmd/areas/targets/prepare/_quarto.yml | 2 +- tmd/areas/targets/prepare/usage.qmd | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/tmd/areas/targets/prepare/_quarto.yml b/tmd/areas/targets/prepare/_quarto.yml index 3f3e8c0e..2c46b235 100644 --- a/tmd/areas/targets/prepare/_quarto.yml +++ b/tmd/areas/targets/prepare/_quarto.yml @@ -35,7 +35,7 @@ book: date-format: long chapters: - index.qmd - - part: "Usage and notes" + - part: "Usage" chapters: - usage.qmd - part: "IRS SOI Congressional District data" diff --git a/tmd/areas/targets/prepare/usage.qmd b/tmd/areas/targets/prepare/usage.qmd index 1e581c83..88d99b03 100644 --- a/tmd/areas/targets/prepare/usage.qmd +++ b/tmd/areas/targets/prepare/usage.qmd @@ -4,16 +4,16 @@ editor_options: chunk_output_type: console --- -# Usage: Creating target files and the local web page +# Usage: How to create Congressional District target files and the associated local web page -**More complete instructions to come, plus use of `renv` to define versions of packages. At present you may need considerable familiarity with R to create target files.** +To Come: Use of `renv` to define versions of packages. ## Prerequisites -- A recent version of [R](https://www.r-project.org/). This project was created with R version 4.4.1. -- Recent version of R packages used by this project. See ".../targets/prepare/R/libraries.R" +- Recent version of [R](https://www.r-project.org/). This project was created with R version 4.4.1. +- Recent versions of R packages used by this project. See ".../targets/prepare/R/libraries.R" - Recent pre-release version of [quarto](https://quarto.org/docs/download/prerelease.html), 1.6 or higher. This project was created with quarto version 1.6.24 -- Be sure that ".../targets/prepare/cds/raw_data/" exists and has the following files: +- Be sure that ".../targets/prepare/cds/raw_data/" exists and has the files shown in the screenshot below. The GitHub repo includes these files: @@ -29,6 +29,12 @@ editor_options: - Open a terminal in the "prepare" folder. - Enter "quarto render" +The first time the project is rendered, it will create needed intermediates files and put them in the "../cds/intermediate" folder. + +Note that the _quarto.yml file sets the `freeze` execution option to `auto`, which means .qmd files will not be rerendered if they have not changed. For a full re-rendering, set `freeze: false`, which will rerender everything regardless of whether code has changed (except that it will not re-render chunks with the option `eval: false`). + +At present the code prepares target files with targets we believe are useful and practical. Users who want different targets will have to modify code to do so. However, as described in overall repo documentation, users can comment-out individual targets. + ## After rendering is complete - target .csv files will be in the ".../targets/prepare/cds/final/" folder From 392ea18038707bb0fff885731c69cfc30c06516a Mon Sep 17 00:00:00 2001 From: donboyd5 Date: Thu, 31 Oct 2024 06:35:38 -0400 Subject: [PATCH 16/24] rename IRS documentation description --- tmd/areas/targets/prepare/_quarto.yml | 2 +- .../{cd_overall_documentation.qmd => cd_IRS_documentation.qmd} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename tmd/areas/targets/prepare/{cd_overall_documentation.qmd => cd_IRS_documentation.qmd} (100%) diff --git a/tmd/areas/targets/prepare/_quarto.yml b/tmd/areas/targets/prepare/_quarto.yml index 2c46b235..1d5e8dec 100644 --- a/tmd/areas/targets/prepare/_quarto.yml +++ b/tmd/areas/targets/prepare/_quarto.yml @@ -49,7 +49,7 @@ book: - cd_map_tcvars_and_extract_target_files.qmd appendices: - cd_issues_and_TODOs.qmd - - cd_overall_documentation.qmd + - cd_IRS_documentation.qmd format: html: diff --git a/tmd/areas/targets/prepare/cd_overall_documentation.qmd b/tmd/areas/targets/prepare/cd_IRS_documentation.qmd similarity index 100% rename from tmd/areas/targets/prepare/cd_overall_documentation.qmd rename to tmd/areas/targets/prepare/cd_IRS_documentation.qmd From fa5bf311fb30e88a7fc331baf4a8db08208c44a4 Mon Sep 17 00:00:00 2001 From: donboyd5 Date: Thu, 31 Oct 2024 06:36:41 -0400 Subject: [PATCH 17/24] fix typo --- tmd/areas/targets/prepare/_quarto.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmd/areas/targets/prepare/_quarto.yml b/tmd/areas/targets/prepare/_quarto.yml index 1d5e8dec..45415576 100644 --- a/tmd/areas/targets/prepare/_quarto.yml +++ b/tmd/areas/targets/prepare/_quarto.yml @@ -29,7 +29,7 @@ execute: book: title: "Develop targets for subnational areas" - subtitle: "Create csv target files for use by area targeting routies" + subtitle: "Create csv target files for use by area targeting routines" # author: "Don Boyd" date: today date-format: long From ff146d8f63257b067093edd34023e6f12e0e5daa Mon Sep 17 00:00:00 2001 From: donboyd5 Date: Thu, 31 Oct 2024 06:50:38 -0400 Subject: [PATCH 18/24] remove 5-year ACS data --- ...nload_and_clean_census_population_data.qmd | 25 +- .../prepare/cds/raw_data/cdpop5year_acs.csv | 441 ------------------ .../targets/prepare/images/raw_data.jpeg | Bin 15415 -> 16820 bytes tmd/areas/targets/prepare/usage.qmd | 7 +- 4 files changed, 17 insertions(+), 456 deletions(-) delete mode 100644 tmd/areas/targets/prepare/cds/raw_data/cdpop5year_acs.csv diff --git a/tmd/areas/targets/prepare/cd_download_and_clean_census_population_data.qmd b/tmd/areas/targets/prepare/cd_download_and_clean_census_population_data.qmd index c382e5c0..0f2311e8 100644 --- a/tmd/areas/targets/prepare/cd_download_and_clean_census_population_data.qmd +++ b/tmd/areas/targets/prepare/cd_download_and_clean_census_population_data.qmd @@ -20,9 +20,9 @@ source(here::here("R", "constants.R")) ## Get Congressional District population -The quarto chunk `cdpop-download` will, if a user sets the chunk `eval` option to `eval: true`, download and save Congressional District population data from the American Community Survey (ACS) for 2021 and for the 5-year period ending in 2021, based on the 116th Congress. +The quarto chunk `cdpop-download` will, if a user sets the chunk `eval` option to `eval: true`, download and save Congressional District population data, based on the 116th Congress, from the American Community Survey (ACS) for 2021. -Ordinarlily this will not be necessary because previously downloaded files are included with the project in the "../cds/raw_data" folder. Thus, the default chunk option is `eval: false` and the chunk will not be run when this project is rendered. +Ordinarily this will not be necessary because previously downloaded files are included with the project in the "../cds/raw_data" folder. Thus, the default chunk option is `eval: false` and the chunk will not be run when this project is rendered. ```{r} #| label: cdpop-download @@ -30,22 +30,25 @@ Ordinarlily this will not be necessary because previously downloaded files are i # Note that 2021 gets data from the 116th Congress and 2022 gets the 218th Congress -cdpop5year <- get_acs( - geography = "congressional district", - variables = "B01003_001", # Total population variable - year = 2021, - survey = "acs5" # Use 5-year estimates for better coverage, especially in smaller areas -) -write_csv(cdpop5year, fs::path(CDRAW, "cdpop5year_acs.csv")) - cdpop1year <- get_acs( geography = "congressional district", variables = "B01003_001", # Total population variable year = 2021, - survey = "acs1" # Use 5-year estimates for better coverage, especially in smaller areas + survey = "acs1" # Consider using 5-year estimates for better coverage, especially in smaller areas ) write_csv(cdpop1year, fs::path(CDRAW, "cdpop1year_acs.csv")) + +# Optionally get 5-year ACS data - possibly useful in the future. +# cdpop5year <- get_acs( +# geography = "congressional district", +# variables = "B01003_001", # Total population variable +# year = 2021, +# survey = "acs5" # Use 5-year estimates for better coverage, especially in smaller areas +# ) +# write_csv(cdpop5year, fs::path(CDRAW, "cdpop5year_acs.csv")) + + ``` ## Clean Congressional District population diff --git a/tmd/areas/targets/prepare/cds/raw_data/cdpop5year_acs.csv b/tmd/areas/targets/prepare/cds/raw_data/cdpop5year_acs.csv deleted file mode 100644 index 3c486ad4..00000000 --- a/tmd/areas/targets/prepare/cds/raw_data/cdpop5year_acs.csv +++ /dev/null @@ -1,441 +0,0 @@ -GEOID,NAME,variable,estimate,moe -0101,"Congressional District 1 (116th Congress), Alabama",B01003_001,722794,567 -0102,"Congressional District 2 (116th Congress), Alabama",B01003_001,689681,2726 -0103,"Congressional District 3 (116th Congress), Alabama",B01003_001,731482,2128 -0104,"Congressional District 4 (116th Congress), Alabama",B01003_001,702255,2470 -0105,"Congressional District 5 (116th Congress), Alabama",B01003_001,751690,203 -0106,"Congressional District 6 (116th Congress), Alabama",B01003_001,731505,3564 -0107,"Congressional District 7 (116th Congress), Alabama",B01003_001,668268,4886 -0200,"Congressional District (at Large) (116th Congress), Alaska",B01003_001,735951,NA -0401,"Congressional District 1 (116th Congress), Arizona",B01003_001,758861,3736 -0402,"Congressional District 2 (116th Congress), Arizona",B01003_001,729613,4064 -0403,"Congressional District 3 (116th Congress), Arizona",B01003_001,780580,6280 -0404,"Congressional District 4 (116th Congress), Arizona",B01003_001,796390,5159 -0405,"Congressional District 5 (116th Congress), Arizona",B01003_001,860467,4661 -0406,"Congressional District 6 (116th Congress), Arizona",B01003_001,769040,7903 -0407,"Congressional District 7 (116th Congress), Arizona",B01003_001,792891,8365 -0408,"Congressional District 8 (116th Congress), Arizona",B01003_001,821009,5254 -0409,"Congressional District 9 (116th Congress), Arizona",B01003_001,770352,5961 -0501,"Congressional District 1 (116th Congress), Arkansas",B01003_001,717868,631 -0502,"Congressional District 2 (116th Congress), Arkansas",B01003_001,767099,NA -0503,"Congressional District 3 (116th Congress), Arkansas",B01003_001,831156,1818 -0504,"Congressional District 4 (116th Congress), Arkansas",B01003_001,690186,1887 -0601,"Congressional District 1 (116th Congress), California",B01003_001,708366,1724 -0602,"Congressional District 2 (116th Congress), California",B01003_001,722327,2203 -0603,"Congressional District 3 (116th Congress), California",B01003_001,757414,2360 -0604,"Congressional District 4 (116th Congress), California",B01003_001,760658,2633 -0605,"Congressional District 5 (116th Congress), California",B01003_001,728345,3063 -0606,"Congressional District 6 (116th Congress), California",B01003_001,781387,4498 -0607,"Congressional District 7 (116th Congress), California",B01003_001,778765,4109 -0608,"Congressional District 8 (116th Congress), California",B01003_001,749184,4114 -0609,"Congressional District 9 (116th Congress), California",B01003_001,796370,3063 -0610,"Congressional District 10 (116th Congress), California",B01003_001,764549,1684 -0611,"Congressional District 11 (116th Congress), California",B01003_001,767298,3334 -0612,"Congressional District 12 (116th Congress), California",B01003_001,757251,3557 -0613,"Congressional District 13 (116th Congress), California",B01003_001,772203,593 -0614,"Congressional District 14 (116th Congress), California",B01003_001,747495,4573 -0615,"Congressional District 15 (116th Congress), California",B01003_001,796865,2467 -0616,"Congressional District 16 (116th Congress), California",B01003_001,747131,4723 -0617,"Congressional District 17 (116th Congress), California",B01003_001,780242,4732 -0618,"Congressional District 18 (116th Congress), California",B01003_001,744528,4858 -0619,"Congressional District 19 (116th Congress), California",B01003_001,754007,5558 -0620,"Congressional District 20 (116th Congress), California",B01003_001,744111,2094 -0621,"Congressional District 21 (116th Congress), California",B01003_001,710344,4663 -0622,"Congressional District 22 (116th Congress), California",B01003_001,786891,4816 -0623,"Congressional District 23 (116th Congress), California",B01003_001,771198,5508 -0624,"Congressional District 24 (116th Congress), California",B01003_001,739183,836 -0625,"Congressional District 25 (116th Congress), California",B01003_001,745689,5060 -0626,"Congressional District 26 (116th Congress), California",B01003_001,722958,1333 -0627,"Congressional District 27 (116th Congress), California",B01003_001,708388,3575 -0628,"Congressional District 28 (116th Congress), California",B01003_001,704354,4998 -0629,"Congressional District 29 (116th Congress), California",B01003_001,703638,7551 -0630,"Congressional District 30 (116th Congress), California",B01003_001,761222,8598 -0631,"Congressional District 31 (116th Congress), California",B01003_001,754741,4540 -0632,"Congressional District 32 (116th Congress), California",B01003_001,705766,3807 -0633,"Congressional District 33 (116th Congress), California",B01003_001,709488,5730 -0634,"Congressional District 34 (116th Congress), California",B01003_001,716495,8743 -0635,"Congressional District 35 (116th Congress), California",B01003_001,739237,3910 -0636,"Congressional District 36 (116th Congress), California",B01003_001,747370,3742 -0637,"Congressional District 37 (116th Congress), California",B01003_001,712613,7618 -0638,"Congressional District 38 (116th Congress), California",B01003_001,711540,3618 -0639,"Congressional District 39 (116th Congress), California",B01003_001,733331,3953 -0640,"Congressional District 40 (116th Congress), California",B01003_001,700867,6339 -0641,"Congressional District 41 (116th Congress), California",B01003_001,752956,3225 -0642,"Congressional District 42 (116th Congress), California",B01003_001,820055,4995 -0643,"Congressional District 43 (116th Congress), California",B01003_001,733353,5722 -0644,"Congressional District 44 (116th Congress), California",B01003_001,714444,6041 -0645,"Congressional District 45 (116th Congress), California",B01003_001,806990,3354 -0646,"Congressional District 46 (116th Congress), California",B01003_001,710498,4270 -0647,"Congressional District 47 (116th Congress), California",B01003_001,714590,4307 -0648,"Congressional District 48 (116th Congress), California",B01003_001,718069,3479 -0649,"Congressional District 49 (116th Congress), California",B01003_001,735611,5408 -0650,"Congressional District 50 (116th Congress), California",B01003_001,752367,5018 -0651,"Congressional District 51 (116th Congress), California",B01003_001,724859,6265 -0652,"Congressional District 52 (116th Congress), California",B01003_001,757448,5930 -0653,"Congressional District 53 (116th Congress), California",B01003_001,770304,6778 -0801,"Congressional District 1 (116th Congress), Colorado",B01003_001,831812,1953 -0802,"Congressional District 2 (116th Congress), Colorado",B01003_001,822288,2419 -0803,"Congressional District 3 (116th Congress), Colorado",B01003_001,755131,575 -0804,"Congressional District 4 (116th Congress), Colorado",B01003_001,858938,2644 -0805,"Congressional District 5 (116th Congress), Colorado",B01003_001,824439,614 -0806,"Congressional District 6 (116th Congress), Colorado",B01003_001,827989,3357 -0807,"Congressional District 7 (116th Congress), Colorado",B01003_001,802579,3382 -0901,"Congressional District 1 (116th Congress), Connecticut",B01003_001,715324,1306 -0902,"Congressional District 2 (116th Congress), Connecticut",B01003_001,702074,411 -0903,"Congressional District 3 (116th Congress), Connecticut",B01003_001,716576,1947 -0904,"Congressional District 4 (116th Congress), Connecticut",B01003_001,745946,525 -0905,"Congressional District 5 (116th Congress), Connecticut",B01003_001,725410,1840 -09ZZ,"Congressional Districts not defined (116th Congress), Connecticut",B01003_001,0,13 -1000,"Congressional District (at Large) (116th Congress), Delaware",B01003_001,981892,NA -1198,"Delegate District (at Large) (116th Congress), District of Columbia",B01003_001,683154,NA -1201,"Congressional District 1 (116th Congress), Florida",B01003_001,797259,711 -1202,"Congressional District 2 (116th Congress), Florida",B01003_001,729598,4174 -1203,"Congressional District 3 (116th Congress), Florida",B01003_001,761626,3548 -1204,"Congressional District 4 (116th Congress), Florida",B01003_001,851023,6207 -1205,"Congressional District 5 (116th Congress), Florida",B01003_001,748057,6837 -1206,"Congressional District 6 (116th Congress), Florida",B01003_001,789744,4121 -1207,"Congressional District 7 (116th Congress), Florida",B01003_001,781734,6189 -1208,"Congressional District 8 (116th Congress), Florida",B01003_001,775458,1883 -1209,"Congressional District 9 (116th Congress), Florida",B01003_001,930697,6735 -1210,"Congressional District 10 (116th Congress), Florida",B01003_001,867042,7820 -1211,"Congressional District 11 (116th Congress), Florida",B01003_001,805200,5172 -1212,"Congressional District 12 (116th Congress), Florida",B01003_001,798316,3456 -1213,"Congressional District 13 (116th Congress), Florida",B01003_001,725783,3068 -1214,"Congressional District 14 (116th Congress), Florida",B01003_001,788149,6875 -1215,"Congressional District 15 (116th Congress), Florida",B01003_001,812631,7420 -1216,"Congressional District 16 (116th Congress), Florida",B01003_001,861259,6055 -1217,"Congressional District 17 (116th Congress), Florida",B01003_001,773890,5280 -1218,"Congressional District 18 (116th Congress), Florida",B01003_001,783441,3474 -1219,"Congressional District 19 (116th Congress), Florida",B01003_001,826628,4764 -1220,"Congressional District 20 (116th Congress), Florida",B01003_001,787098,5466 -1221,"Congressional District 21 (116th Congress), Florida",B01003_001,784165,4488 -1222,"Congressional District 22 (116th Congress), Florida",B01003_001,767612,3752 -1223,"Congressional District 23 (116th Congress), Florida",B01003_001,762612,2803 -1224,"Congressional District 24 (116th Congress), Florida",B01003_001,748479,7630 -1225,"Congressional District 25 (116th Congress), Florida",B01003_001,769234,5151 -1226,"Congressional District 26 (116th Congress), Florida",B01003_001,785278,8717 -1227,"Congressional District 27 (116th Congress), Florida",B01003_001,727749,7287 -1301,"Congressional District 1 (116th Congress), Georgia",B01003_001,752393,1403 -1302,"Congressional District 2 (116th Congress), Georgia",B01003_001,671948,2709 -1303,"Congressional District 3 (116th Congress), Georgia",B01003_001,756277,4276 -1304,"Congressional District 4 (116th Congress), Georgia",B01003_001,768431,6635 -1305,"Congressional District 5 (116th Congress), Georgia",B01003_001,778225,6034 -1306,"Congressional District 6 (116th Congress), Georgia",B01003_001,757644,5087 -1307,"Congressional District 7 (116th Congress), Georgia",B01003_001,854516,6359 -1308,"Congressional District 8 (116th Congress), Georgia",B01003_001,715067,1765 -1309,"Congressional District 9 (116th Congress), Georgia",B01003_001,770045,2541 -1310,"Congressional District 10 (116th Congress), Georgia",B01003_001,765152,5380 -1311,"Congressional District 11 (116th Congress), Georgia",B01003_001,788712,5400 -1312,"Congressional District 12 (116th Congress), Georgia",B01003_001,734110,2250 -1313,"Congressional District 13 (116th Congress), Georgia",B01003_001,788497,7223 -1314,"Congressional District 14 (116th Congress), Georgia",B01003_001,724598,904 -1501,"Congressional District 1 (116th Congress), Hawaii",B01003_001,729555,3794 -1502,"Congressional District 2 (116th Congress), Hawaii",B01003_001,723943,3794 -1601,"Congressional District 1 (116th Congress), Idaho",B01003_001,941417,1938 -1602,"Congressional District 2 (116th Congress), Idaho",B01003_001,870200,1937 -1701,"Congressional District 1 (116th Congress), Illinois",B01003_001,715763,6815 -1702,"Congressional District 2 (116th Congress), Illinois",B01003_001,686546,4396 -1703,"Congressional District 3 (116th Congress), Illinois",B01003_001,724550,6739 -1704,"Congressional District 4 (116th Congress), Illinois",B01003_001,690373,8224 -1705,"Congressional District 5 (116th Congress), Illinois",B01003_001,752522,6581 -1706,"Congressional District 6 (116th Congress), Illinois",B01003_001,732738,4399 -1707,"Congressional District 7 (116th Congress), Illinois",B01003_001,738479,7668 -1708,"Congressional District 8 (116th Congress), Illinois",B01003_001,720276,3769 -1709,"Congressional District 9 (116th Congress), Illinois",B01003_001,745865,6115 -1710,"Congressional District 10 (116th Congress), Illinois",B01003_001,722961,3184 -1711,"Congressional District 11 (116th Congress), Illinois",B01003_001,706594,3587 -1712,"Congressional District 12 (116th Congress), Illinois",B01003_001,679543,73 -1713,"Congressional District 13 (116th Congress), Illinois",B01003_001,697929,2849 -1714,"Congressional District 14 (116th Congress), Illinois",B01003_001,750475,3589 -1715,"Congressional District 15 (116th Congress), Illinois",B01003_001,683592,1138 -1716,"Congressional District 16 (116th Congress), Illinois",B01003_001,693820,1877 -1717,"Congressional District 17 (116th Congress), Illinois",B01003_001,677247,2703 -1718,"Congressional District 18 (116th Congress), Illinois",B01003_001,702540,3482 -17ZZ,"Congressional Districts not defined (116th Congress), Illinois",B01003_001,0,12 -1801,"Congressional District 1 (116th Congress), Indiana",B01003_001,729457,567 -1802,"Congressional District 2 (116th Congress), Indiana",B01003_001,729091,683 -1803,"Congressional District 3 (116th Congress), Indiana",B01003_001,754959,418 -1804,"Congressional District 4 (116th Congress), Indiana",B01003_001,761534,1044 -1805,"Congressional District 5 (116th Congress), Indiana",B01003_001,794485,3733 -1806,"Congressional District 6 (116th Congress), Indiana",B01003_001,721972,467 -1807,"Congressional District 7 (116th Congress), Indiana",B01003_001,782178,3714 -1808,"Congressional District 8 (116th Congress), Indiana",B01003_001,715129,338 -1809,"Congressional District 9 (116th Congress), Indiana",B01003_001,762535,684 -1901,"Congressional District 1 (116th Congress), Iowa",B01003_001,778247,NA -1902,"Congressional District 2 (116th Congress), Iowa",B01003_001,784135,NA -1903,"Congressional District 3 (116th Congress), Iowa",B01003_001,852016,NA -1904,"Congressional District 4 (116th Congress), Iowa",B01003_001,764692,NA -2001,"Congressional District 1 (116th Congress), Kansas",B01003_001,702619,235 -2002,"Congressional District 2 (116th Congress), Kansas",B01003_001,714255,487 -2003,"Congressional District 3 (116th Congress), Kansas",B01003_001,785916,460 -2004,"Congressional District 4 (116th Congress), Kansas",B01003_001,729309,180 -2101,"Congressional District 1 (116th Congress), Kentucky",B01003_001,719030,177 -2102,"Congressional District 2 (116th Congress), Kentucky",B01003_001,773346,880 -2103,"Congressional District 3 (116th Congress), Kentucky",B01003_001,754909,1868 -2104,"Congressional District 4 (116th Congress), Kentucky",B01003_001,771347,2149 -2105,"Congressional District 5 (116th Congress), Kentucky",B01003_001,694860,770 -2106,"Congressional District 6 (116th Congress), Kentucky",B01003_001,780649,823 -2201,"Congressional District 1 (116th Congress), Louisiana",B01003_001,805369,4760 -2202,"Congressional District 2 (116th Congress), Louisiana",B01003_001,782637,5845 -2203,"Congressional District 3 (116th Congress), Louisiana",B01003_001,784283,756 -2204,"Congressional District 4 (116th Congress), Louisiana",B01003_001,732845,1827 -2205,"Congressional District 5 (116th Congress), Louisiana",B01003_001,741889,2667 -2206,"Congressional District 6 (116th Congress), Louisiana",B01003_001,810282,5616 -2301,"Congressional District 1 (116th Congress), Maine",B01003_001,699795,209 -2302,"Congressional District 2 (116th Congress), Maine",B01003_001,657251,209 -2401,"Congressional District 1 (116th Congress), Maryland",B01003_001,741327,3018 -2402,"Congressional District 2 (116th Congress), Maryland",B01003_001,782892,7289 -2403,"Congressional District 3 (116th Congress), Maryland",B01003_001,762898,8288 -2404,"Congressional District 4 (116th Congress), Maryland",B01003_001,790373,5839 -2405,"Congressional District 5 (116th Congress), Maryland",B01003_001,786660,4621 -2406,"Congressional District 6 (116th Congress), Maryland",B01003_001,784464,4464 -2407,"Congressional District 7 (116th Congress), Maryland",B01003_001,718069,6219 -2408,"Congressional District 8 (116th Congress), Maryland",B01003_001,781862,5696 -2501,"Congressional District 1 (116th Congress), Massachusetts",B01003_001,730273,471 -2502,"Congressional District 2 (116th Congress), Massachusetts",B01003_001,775094,830 -2503,"Congressional District 3 (116th Congress), Massachusetts",B01003_001,791898,932 -2504,"Congressional District 4 (116th Congress), Massachusetts",B01003_001,771803,1792 -2505,"Congressional District 5 (116th Congress), Massachusetts",B01003_001,791364,1550 -2506,"Congressional District 6 (116th Congress), Massachusetts",B01003_001,774573,680 -2507,"Congressional District 7 (116th Congress), Massachusetts",B01003_001,799546,4251 -2508,"Congressional District 8 (116th Congress), Massachusetts",B01003_001,786564,3735 -2509,"Congressional District 9 (116th Congress), Massachusetts",B01003_001,770737,1598 -2601,"Congressional District 1 (116th Congress), Michigan",B01003_001,704864,367 -2602,"Congressional District 2 (116th Congress), Michigan",B01003_001,753783,552 -2603,"Congressional District 3 (116th Congress), Michigan",B01003_001,750350,84 -2604,"Congressional District 4 (116th Congress), Michigan",B01003_001,697813,862 -2605,"Congressional District 5 (116th Congress), Michigan",B01003_001,672455,1056 -2606,"Congressional District 6 (116th Congress), Michigan",B01003_001,720211,440 -2607,"Congressional District 7 (116th Congress), Michigan",B01003_001,714616,612 -2608,"Congressional District 8 (116th Congress), Michigan",B01003_001,739057,593 -2609,"Congressional District 9 (116th Congress), Michigan",B01003_001,721023,1526 -2610,"Congressional District 10 (116th Congress), Michigan",B01003_001,723323,1654 -2611,"Congressional District 11 (116th Congress), Michigan",B01003_001,754129,1343 -2612,"Congressional District 12 (116th Congress), Michigan",B01003_001,742875,1296 -2613,"Congressional District 13 (116th Congress), Michigan",B01003_001,674752,5585 -2614,"Congressional District 14 (116th Congress), Michigan",B01003_001,693261,5251 -26ZZ,"Congressional Districts not defined (116th Congress), Michigan",B01003_001,0,11 -2701,"Congressional District 1 (116th Congress), Minnesota",B01003_001,687886,392 -2702,"Congressional District 2 (116th Congress), Minnesota",B01003_001,725672,487 -2703,"Congressional District 3 (116th Congress), Minnesota",B01003_001,732483,860 -2704,"Congressional District 4 (116th Congress), Minnesota",B01003_001,721898,435 -2705,"Congressional District 5 (116th Congress), Minnesota",B01003_001,728368,842 -2706,"Congressional District 6 (116th Congress), Minnesota",B01003_001,727471,807 -2707,"Congressional District 7 (116th Congress), Minnesota",B01003_001,672622,875 -2708,"Congressional District 8 (116th Congress), Minnesota",B01003_001,674072,514 -2801,"Congressional District 1 (116th Congress), Mississippi",B01003_001,757560,575 -2802,"Congressional District 2 (116th Congress), Mississippi",B01003_001,685584,2051 -2803,"Congressional District 3 (116th Congress), Mississippi",B01003_001,748808,2196 -2804,"Congressional District 4 (116th Congress), Mississippi",B01003_001,775071,442 -2901,"Congressional District 1 (116th Congress), Missouri",B01003_001,720952,3107 -2902,"Congressional District 2 (116th Congress), Missouri",B01003_001,770323,4010 -2903,"Congressional District 3 (116th Congress), Missouri",B01003_001,800026,3786 -2904,"Congressional District 4 (116th Congress), Missouri",B01003_001,775737,1300 -2905,"Congressional District 5 (116th Congress), Missouri",B01003_001,784962,3177 -2906,"Congressional District 6 (116th Congress), Missouri",B01003_001,778899,3287 -2907,"Congressional District 7 (116th Congress), Missouri",B01003_001,788437,589 -2908,"Congressional District 8 (116th Congress), Missouri",B01003_001,722198,2136 -3000,"Congressional District (at Large) (116th Congress), Montana",B01003_001,1077978,NA -3101,"Congressional District 1 (116th Congress), Nebraska",B01003_001,657029,1230 -3102,"Congressional District 2 (116th Congress), Nebraska",B01003_001,693079,1216 -3103,"Congressional District 3 (116th Congress), Nebraska",B01003_001,601372,97 -3201,"Congressional District 1 (116th Congress), Nevada",B01003_001,688773,7709 -3202,"Congressional District 2 (116th Congress), Nevada",B01003_001,748896,731 -3203,"Congressional District 3 (116th Congress), Nevada",B01003_001,840860,6666 -3204,"Congressional District 4 (116th Congress), Nevada",B01003_001,780709,6334 -3301,"Congressional District 1 (116th Congress), New Hampshire",B01003_001,694723,211 -3302,"Congressional District 2 (116th Congress), New Hampshire",B01003_001,677452,211 -3401,"Congressional District 1 (116th Congress), New Jersey",B01003_001,748305,517 -3402,"Congressional District 2 (116th Congress), New Jersey",B01003_001,732891,1244 -3403,"Congressional District 3 (116th Congress), New Jersey",B01003_001,753485,1155 -3404,"Congressional District 4 (116th Congress), New Jersey",B01003_001,790796,1187 -3405,"Congressional District 5 (116th Congress), New Jersey",B01003_001,747027,1044 -3406,"Congressional District 6 (116th Congress), New Jersey",B01003_001,762161,1875 -3407,"Congressional District 7 (116th Congress), New Jersey",B01003_001,757080,1225 -3408,"Congressional District 8 (116th Congress), New Jersey",B01003_001,806843,5594 -3409,"Congressional District 9 (116th Congress), New Jersey",B01003_001,785894,1456 -3410,"Congressional District 10 (116th Congress), New Jersey",B01003_001,811105,5589 -3411,"Congressional District 11 (116th Congress), New Jersey",B01003_001,757864,1891 -3412,"Congressional District 12 (116th Congress), New Jersey",B01003_001,780573,1617 -3501,"Congressional District 1 (116th Congress), New Mexico",B01003_001,693653,2387 -3502,"Congressional District 2 (116th Congress), New Mexico",B01003_001,711510,1795 -3503,"Congressional District 3 (116th Congress), New Mexico",B01003_001,704203,2560 -3601,"Congressional District 1 (116th Congress), New York",B01003_001,738752,1856 -3602,"Congressional District 2 (116th Congress), New York",B01003_001,730154,3359 -3603,"Congressional District 3 (116th Congress), New York",B01003_001,742196,5273 -3604,"Congressional District 4 (116th Congress), New York",B01003_001,747392,3808 -3605,"Congressional District 5 (116th Congress), New York",B01003_001,813708,8464 -3606,"Congressional District 6 (116th Congress), New York",B01003_001,760652,8494 -3607,"Congressional District 7 (116th Congress), New York",B01003_001,752935,8458 -3608,"Congressional District 8 (116th Congress), New York",B01003_001,818072,7263 -3609,"Congressional District 9 (116th Congress), New York",B01003_001,757933,7510 -3610,"Congressional District 10 (116th Congress), New York",B01003_001,763710,9157 -3611,"Congressional District 11 (116th Congress), New York",B01003_001,761248,4810 -3612,"Congressional District 12 (116th Congress), New York",B01003_001,741461,9564 -3613,"Congressional District 13 (116th Congress), New York",B01003_001,780893,9853 -3614,"Congressional District 14 (116th Congress), New York",B01003_001,717057,8189 -3615,"Congressional District 15 (116th Congress), New York",B01003_001,755887,7476 -3616,"Congressional District 16 (116th Congress), New York",B01003_001,774781,6022 -3617,"Congressional District 17 (116th Congress), New York",B01003_001,761994,975 -3618,"Congressional District 18 (116th Congress), New York",B01003_001,743362,1285 -3619,"Congressional District 19 (116th Congress), New York",B01003_001,701650,1300 -3620,"Congressional District 20 (116th Congress), New York",B01003_001,743851,1129 -3621,"Congressional District 21 (116th Congress), New York",B01003_001,708621,1022 -3622,"Congressional District 22 (116th Congress), New York",B01003_001,697709,844 -3623,"Congressional District 23 (116th Congress), New York",B01003_001,694520,631 -3624,"Congressional District 24 (116th Congress), New York",B01003_001,716288,261 -3625,"Congressional District 25 (116th Congress), New York",B01003_001,730626,232 -3626,"Congressional District 26 (116th Congress), New York",B01003_001,738583,980 -3627,"Congressional District 27 (116th Congress), New York",B01003_001,720710,1033 -3701,"Congressional District 1 (116th Congress), North Carolina",B01003_001,741907,3387 -3702,"Congressional District 2 (116th Congress), North Carolina",B01003_001,892874,4656 -3703,"Congressional District 3 (116th Congress), North Carolina",B01003_001,752206,2102 -3704,"Congressional District 4 (116th Congress), North Carolina",B01003_001,867309,4156 -3705,"Congressional District 5 (116th Congress), North Carolina",B01003_001,756848,1116 -3706,"Congressional District 6 (116th Congress), North Carolina",B01003_001,789755,4077 -3707,"Congressional District 7 (116th Congress), North Carolina",B01003_001,772968,2880 -3708,"Congressional District 8 (116th Congress), North Carolina",B01003_001,805788,2340 -3709,"Congressional District 9 (116th Congress), North Carolina",B01003_001,764664,4168 -3710,"Congressional District 10 (116th Congress), North Carolina",B01003_001,769560,2812 -3711,"Congressional District 11 (116th Congress), North Carolina",B01003_001,766426,2584 -3712,"Congressional District 12 (116th Congress), North Carolina",B01003_001,895417,4056 -3713,"Congressional District 13 (116th Congress), North Carolina",B01003_001,791300,4594 -3800,"Congressional District (at Large) (116th Congress), North Dakota",B01003_001,773344,NA -3901,"Congressional District 1 (116th Congress), Ohio",B01003_001,763591,2797 -3902,"Congressional District 2 (116th Congress), Ohio",B01003_001,732156,2949 -3903,"Congressional District 3 (116th Congress), Ohio",B01003_001,804631,5426 -3904,"Congressional District 4 (116th Congress), Ohio",B01003_001,715108,1263 -3905,"Congressional District 5 (116th Congress), Ohio",B01003_001,728981,2134 -3906,"Congressional District 6 (116th Congress), Ohio",B01003_001,689093,1106 -3907,"Congressional District 7 (116th Congress), Ohio",B01003_001,737294,2225 -3908,"Congressional District 8 (116th Congress), Ohio",B01003_001,742413,414 -3909,"Congressional District 9 (116th Congress), Ohio",B01003_001,707993,3772 -3910,"Congressional District 10 (116th Congress), Ohio",B01003_001,727632,415 -3911,"Congressional District 11 (116th Congress), Ohio",B01003_001,690420,3865 -3912,"Congressional District 12 (116th Congress), Ohio",B01003_001,801233,3717 -3913,"Congressional District 13 (116th Congress), Ohio",B01003_001,703031,2173 -3914,"Congressional District 14 (116th Congress), Ohio",B01003_001,726849,1407 -3915,"Congressional District 15 (116th Congress), Ohio",B01003_001,764503,4101 -3916,"Congressional District 16 (116th Congress), Ohio",B01003_001,734995,2316 -4001,"Congressional District 1 (116th Congress), Oklahoma",B01003_001,822185,606 -4002,"Congressional District 2 (116th Congress), Oklahoma",B01003_001,726329,540 -4003,"Congressional District 3 (116th Congress), Oklahoma",B01003_001,783317,706 -4004,"Congressional District 4 (116th Congress), Oklahoma",B01003_001,797930,1645 -4005,"Congressional District 5 (116th Congress), Oklahoma",B01003_001,818375,1634 -4101,"Congressional District 1 (116th Congress), Oregon",B01003_001,856074,1880 -4102,"Congressional District 2 (116th Congress), Oregon",B01003_001,843033,1030 -4103,"Congressional District 3 (116th Congress), Oregon",B01003_001,844479,2968 -4104,"Congressional District 4 (116th Congress), Oregon",B01003_001,818485,1030 -4105,"Congressional District 5 (116th Congress), Oregon",B01003_001,845106,2266 -4201,"Congressional District 1 (116th Congress), Pennsylvania",B01003_001,728310,715 -4202,"Congressional District 2 (116th Congress), Pennsylvania",B01003_001,741528,7619 -4203,"Congressional District 3 (116th Congress), Pennsylvania",B01003_001,736685,7256 -4204,"Congressional District 4 (116th Congress), Pennsylvania",B01003_001,750478,1478 -4205,"Congressional District 5 (116th Congress), Pennsylvania",B01003_001,728014,4056 -4206,"Congressional District 6 (116th Congress), Pennsylvania",B01003_001,748941,1223 -4207,"Congressional District 7 (116th Congress), Pennsylvania",B01003_001,742270,671 -4208,"Congressional District 8 (116th Congress), Pennsylvania",B01003_001,711220,988 -4209,"Congressional District 9 (116th Congress), Pennsylvania",B01003_001,706475,1420 -4210,"Congressional District 10 (116th Congress), Pennsylvania",B01003_001,754965,1014 -4211,"Congressional District 11 (116th Congress), Pennsylvania",B01003_001,744465,925 -4212,"Congressional District 12 (116th Congress), Pennsylvania",B01003_001,688872,610 -4213,"Congressional District 13 (116th Congress), Pennsylvania",B01003_001,696156,1207 -4214,"Congressional District 14 (116th Congress), Pennsylvania",B01003_001,690770,821 -4215,"Congressional District 15 (116th Congress), Pennsylvania",B01003_001,677635,987 -4216,"Congressional District 16 (116th Congress), Pennsylvania",B01003_001,688843,850 -4217,"Congressional District 17 (116th Congress), Pennsylvania",B01003_001,733477,1328 -4218,"Congressional District 18 (116th Congress), Pennsylvania",B01003_001,701546,1340 -4401,"Congressional District 1 (116th Congress), Rhode Island",B01003_001,551867,2567 -4402,"Congressional District 2 (116th Congress), Rhode Island",B01003_001,540082,2567 -4501,"Congressional District 1 (116th Congress), South Carolina",B01003_001,802857,3616 -4502,"Congressional District 2 (116th Congress), South Carolina",B01003_001,717963,3478 -4503,"Congressional District 3 (116th Congress), South Carolina",B01003_001,700576,2842 -4504,"Congressional District 4 (116th Congress), South Carolina",B01003_001,752791,3305 -4505,"Congressional District 5 (116th Congress), South Carolina",B01003_001,727226,2269 -4506,"Congressional District 6 (116th Congress), South Carolina",B01003_001,653349,5431 -4507,"Congressional District 7 (116th Congress), South Carolina",B01003_001,724141,829 -4600,"Congressional District (at Large) (116th Congress), South Dakota",B01003_001,881785,NA -4701,"Congressional District 1 (116th Congress), Tennessee",B01003_001,725183,799 -4702,"Congressional District 2 (116th Congress), Tennessee",B01003_001,767016,942 -4703,"Congressional District 3 (116th Congress), Tennessee",B01003_001,734250,1757 -4704,"Congressional District 4 (116th Congress), Tennessee",B01003_001,821348,2253 -4705,"Congressional District 5 (116th Congress), Tennessee",B01003_001,792617,639 -4706,"Congressional District 6 (116th Congress), Tennessee",B01003_001,800493,699 -4707,"Congressional District 7 (116th Congress), Tennessee",B01003_001,812291,1472 -4708,"Congressional District 8 (116th Congress), Tennessee",B01003_001,712769,3434 -4709,"Congressional District 9 (116th Congress), Tennessee",B01003_001,693530,3412 -4801,"Congressional District 1 (116th Congress), Texas",B01003_001,720481,1217 -4802,"Congressional District 2 (116th Congress), Texas",B01003_001,814155,11569 -4803,"Congressional District 3 (116th Congress), Texas",B01003_001,910097,2479 -4804,"Congressional District 4 (116th Congress), Texas",B01003_001,783941,2353 -4805,"Congressional District 5 (116th Congress), Texas",B01003_001,773738,4908 -4806,"Congressional District 6 (116th Congress), Texas",B01003_001,821592,5681 -4807,"Congressional District 7 (116th Congress), Texas",B01003_001,791353,11056 -4808,"Congressional District 8 (116th Congress), Texas",B01003_001,901501,5725 -4809,"Congressional District 9 (116th Congress), Texas",B01003_001,765963,10633 -4810,"Congressional District 10 (116th Congress), Texas",B01003_001,921341,10756 -4811,"Congressional District 11 (116th Congress), Texas",B01003_001,771174,1463 -4812,"Congressional District 12 (116th Congress), Texas",B01003_001,846301,7416 -4813,"Congressional District 13 (116th Congress), Texas",B01003_001,709295,1341 -4814,"Congressional District 14 (116th Congress), Texas",B01003_001,771651,3308 -4815,"Congressional District 15 (116th Congress), Texas",B01003_001,803835,5382 -4816,"Congressional District 16 (116th Congress), Texas",B01003_001,755415,3104 -4817,"Congressional District 17 (116th Congress), Texas",B01003_001,802448,4943 -4818,"Congressional District 18 (116th Congress), Texas",B01003_001,789886,10929 -4819,"Congressional District 19 (116th Congress), Texas",B01003_001,728159,500 -4820,"Congressional District 20 (116th Congress), Texas",B01003_001,798649,9033 -4821,"Congressional District 21 (116th Congress), Texas",B01003_001,826193,7802 -4822,"Congressional District 22 (116th Congress), Texas",B01003_001,961113,6708 -4823,"Congressional District 23 (116th Congress), Texas",B01003_001,806245,6769 -4824,"Congressional District 24 (116th Congress), Texas",B01003_001,809110,5404 -4825,"Congressional District 25 (116th Congress), Texas",B01003_001,832621,6170 -4826,"Congressional District 26 (116th Congress), Texas",B01003_001,923492,4561 -4827,"Congressional District 27 (116th Congress), Texas",B01003_001,739341,2401 -4828,"Congressional District 28 (116th Congress), Texas",B01003_001,770051,6331 -4829,"Congressional District 29 (116th Congress), Texas",B01003_001,734456,9660 -4830,"Congressional District 30 (116th Congress), Texas",B01003_001,789297,7333 -4831,"Congressional District 31 (116th Congress), Texas",B01003_001,914699,2809 -4832,"Congressional District 32 (116th Congress), Texas",B01003_001,771112,5602 -4833,"Congressional District 33 (116th Congress), Texas",B01003_001,727423,8140 -4834,"Congressional District 34 (116th Congress), Texas",B01003_001,712253,3285 -4835,"Congressional District 35 (116th Congress), Texas",B01003_001,805089,9160 -4836,"Congressional District 36 (116th Congress), Texas",B01003_001,759111,5942 -4901,"Congressional District 1 (116th Congress), Utah",B01003_001,792511,406 -4902,"Congressional District 2 (116th Congress), Utah",B01003_001,792727,3312 -4903,"Congressional District 3 (116th Congress), Utah",B01003_001,778400,2947 -4904,"Congressional District 4 (116th Congress), Utah",B01003_001,867732,4904 -5000,"Congressional District (at Large) (116th Congress), Vermont",B01003_001,641637,NA -5101,"Congressional District 1 (116th Congress), Virginia",B01003_001,816464,3851 -5102,"Congressional District 2 (116th Congress), Virginia",B01003_001,747365,2992 -5103,"Congressional District 3 (116th Congress), Virginia",B01003_001,752479,4050 -5104,"Congressional District 4 (116th Congress), Virginia",B01003_001,785406,4385 -5105,"Congressional District 5 (116th Congress), Virginia",B01003_001,741491,2031 -5106,"Congressional District 6 (116th Congress), Virginia",B01003_001,759456,1956 -5107,"Congressional District 7 (116th Congress), Virginia",B01003_001,811302,4034 -5108,"Congressional District 8 (116th Congress), Virginia",B01003_001,796645,4679 -5109,"Congressional District 9 (116th Congress), Virginia",B01003_001,698788,1241 -5110,"Congressional District 10 (116th Congress), Virginia",B01003_001,869926,4707 -5111,"Congressional District 11 (116th Congress), Virginia",B01003_001,803157,6090 -5301,"Congressional District 1 (116th Congress), Washington",B01003_001,778963,4715 -5302,"Congressional District 2 (116th Congress), Washington",B01003_001,758640,3812 -5303,"Congressional District 3 (116th Congress), Washington",B01003_001,762407,1574 -5304,"Congressional District 4 (116th Congress), Washington",B01003_001,744547,1066 -5305,"Congressional District 5 (116th Congress), Washington",B01003_001,742007,714 -5306,"Congressional District 6 (116th Congress), Washington",B01003_001,729130,2634 -5307,"Congressional District 7 (116th Congress), Washington",B01003_001,787902,3629 -5308,"Congressional District 8 (116th Congress), Washington",B01003_001,772133,4277 -5309,"Congressional District 9 (116th Congress), Washington",B01003_001,765280,4217 -5310,"Congressional District 10 (116th Congress), Washington",B01003_001,776355,4305 -5401,"Congressional District 1 (116th Congress), West Virginia",B01003_001,604226,NA -5402,"Congressional District 2 (116th Congress), West Virginia",B01003_001,621999,NA -5403,"Congressional District 3 (116th Congress), West Virginia",B01003_001,574824,NA -5501,"Congressional District 1 (116th Congress), Wisconsin",B01003_001,725418,1238 -5502,"Congressional District 2 (116th Congress), Wisconsin",B01003_001,783230,628 -5503,"Congressional District 3 (116th Congress), Wisconsin",B01003_001,731014,882 -5504,"Congressional District 4 (116th Congress), Wisconsin",B01003_001,696075,296 -5505,"Congressional District 5 (116th Congress), Wisconsin",B01003_001,732692,1343 -5506,"Congressional District 6 (116th Congress), Wisconsin",B01003_001,725311,783 -5507,"Congressional District 7 (116th Congress), Wisconsin",B01003_001,729683,848 -5508,"Congressional District 8 (116th Congress), Wisconsin",B01003_001,748238,265 -5600,"Congressional District (at Large) (116th Congress), Wyoming",B01003_001,576641,NA -7298,"Resident Commissioner District (at Large) (116th Congress), Puerto Rico",B01003_001,3311274,NA diff --git a/tmd/areas/targets/prepare/images/raw_data.jpeg b/tmd/areas/targets/prepare/images/raw_data.jpeg index a928fd32bdf8aad3e9f9a3c10e7bca0d6e06d365..ecc42a8c74f0533d2c9750d190dc7b23e5da6aea 100644 GIT binary patch delta 15505 zcmbt*RZv_}yJh1Lf`p*K5+o2B2?W;=v~hP0P6u~A1Of?-LvRc3?(Q@aAZSD55Zqk@ z!@cv*!_?fjdHAY!)u}qQYu8z4ecxJZH+a?tp+x7R)uI|#6%3-N-?F^R(=my)ysIiQ zJ4fRQccWI#+z8~Rc2A=Iaqlb^&t3j@-$7LeO?6s{lS)Q7>fCDU5kymDGF2g2$o^TK zvQcsHCHsUDmYUDFC7JXzv8t?TTm_v%TnC*nAVsW#p{V{KuHA9b^$0qDDRbnzemC%N zbVYDIUJMMdTs<_3Jp|gcP>zT-g&jVEd>%n%ir8O_EC)F0{6An!`H$EXL%%*Lhi(uXQI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AAxX5P_BT%aad=YSA%M&n8+M#m={@c-gV$3s4qo6=#Zr?W5G_* zg=Mp^#7k3&>)|67P5BnP>Kh+?ok!63R#BfqKNudDpmb}<67dg#B5FluPN9XY*Z6O+ zDQUtiG6)+HuJ;%_aqnlFB~Az?*^}@XfcqV@tOS49oeOuis>cQd8`0S^pr3Qc8{70G$x)52ig@2raD0+t|cY=B*!^>%zWnC=+Z`R2w}6YPaQAC7S5iyi|Eo{`DuZ}7 zRb{%C8WJhAOO@VR-PW7>F!^j4mHz%;o;WUq^B-oWL~L&*)GgOPf;J~~+&Qkp!6~=> z9^P{Nv-OC>ocOMs`XSm(=9czNQ7Pn;pjgF~wHCi8N61_0s-~KzSYQjOpf$i(z`ahZ z_XzTtUFQGc_X{E*a^GK(#UIqRS?g%n=RKB1arMP<7?%xS8k@3nL%R%5ZiEy%wD;TE0iErX4;p|N0;N4#m6u5bIS9hnR+eG(2!*<{~EPj!xceZ)@uEPTU zOT<@~7uYON{{MXg{|DjzKQ_GM=fYN)p%R=r zZ{g^VAdYmgk0rw{7eo(>Q-kvzGO|UfRMyqVL&xeTN=>7Ro?@wxYHqn#zWC?!oBSu% V{U2tr|6;%Y!=nG|8sKsMe*r#!Ql|g_ diff --git a/tmd/areas/targets/prepare/usage.qmd b/tmd/areas/targets/prepare/usage.qmd index 88d99b03..2d6478af 100644 --- a/tmd/areas/targets/prepare/usage.qmd +++ b/tmd/areas/targets/prepare/usage.qmd @@ -18,7 +18,6 @@ To Come: Use of `renv` to define versions of packages. - @@ -31,19 +30,19 @@ To Come: Use of `renv` to define versions of packages. The first time the project is rendered, it will create needed intermediates files and put them in the "../cds/intermediate" folder. -Note that the _quarto.yml file sets the `freeze` execution option to `auto`, which means .qmd files will not be rerendered if they have not changed. For a full re-rendering, set `freeze: false`, which will rerender everything regardless of whether code has changed (except that it will not re-render chunks with the option `eval: false`). +Note that the \_quarto.yml file sets the `freeze` execution option to `auto`, which means .qmd files will not be rerendered if they have not changed. For a full re-rendering, set `freeze: false`, which will rerender everything regardless of whether code has changed (except that it will not re-render chunks with the option `eval: false`). At present the code prepares target files with targets we believe are useful and practical. Users who want different targets will have to modify code to do so. However, as described in overall repo documentation, users can comment-out individual targets. ## After rendering is complete - target .csv files will be in the ".../targets/prepare/cds/final/" folder -- local documentation web page will be in the ".../targets/prepare/_targetprep/" folder +- local documentation web page will be in the ".../targets/prepare/\_targetprep/" folder ## To create area weights using the target files in tax-microdata-benchmarking - copy desired target .csv files from ".../targets/prepare/cds/final/" folder to the ".../targets/" folder -- follow tax-microdata-benchmarking instructions to run `make_all.py` or `create_area_weights.py' +- follow tax-microdata-benchmarking instructions to run `make_all.py` or \`create_area_weights.py' ## Additional notes From 6c2eaa0f66d682e7aeae24ad8233c4d8fc6c21ee Mon Sep 17 00:00:00 2001 From: donboyd5 Date: Thu, 31 Oct 2024 06:58:49 -0400 Subject: [PATCH 19/24] improve agi bin documentation; show bins --- .../cd_construct_long_soi_data_file.qmd | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/tmd/areas/targets/prepare/cd_construct_long_soi_data_file.qmd b/tmd/areas/targets/prepare/cd_construct_long_soi_data_file.qmd index 39be622e..28571f8b 100644 --- a/tmd/areas/targets/prepare/cd_construct_long_soi_data_file.qmd +++ b/tmd/areas/targets/prepare/cd_construct_long_soi_data_file.qmd @@ -6,7 +6,7 @@ editor_options: # Parse the Congressional District data -Clean the SOI Congressional District data and save. +Clean the SOI Congressional District data and save as a long file. ## Setup @@ -28,12 +28,13 @@ Here is an example of the first few rows of a targets file: ![](images/Image 2024-10-20 at 5.23.32 PM.jpeg) -## Create AGI stub information +## Create and save AGI bin labels, and show bins -Create AGI bin labels that map to the AGI bins that SOI uses. +Create and map AGI bin labels to the AGI bins that SOI uses, and save in ".../cds/intermediate". ```{r} #| label: agi-bins +#| output: false # example of targets file # varname,count,scope,agilo,agihi,fstatus,target @@ -85,6 +86,13 @@ file="AGI_STUB; agirange; agilo; agihi write_csv(agibins, fs::path(CDINTERMEDIATE, "cd_agi_bins.csv")) +``` + +Show AGI bins. + +```{r} +#| label: show-agi-bins + # agibins |> kable() agibins |> gt() |> @@ -98,13 +106,15 @@ agibins |> ``` -## Prepare, clean, and save wide data file -Set eval: to true for these chunks to recreate the data file. +## Prepare, clean, and save SOI Congressional District wide data file + +Get previously downloaded IRS SOI data with aggregate information for individual Congressional Districts. ```{r} #| label: parse-cddata #| eval: true +#| output: false # read the csv file from the zip archive that contains it zpath <- fs::path(CDRAW, fs::path_file(CDZIPURL)) From 3c4d61b091ea3da3231a2b455357091e613d7303 Mon Sep 17 00:00:00 2001 From: donboyd5 Date: Thu, 31 Oct 2024 07:02:26 -0400 Subject: [PATCH 20/24] document wide-file cleaning --- .../targets/prepare/cd_construct_long_soi_data_file.qmd | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tmd/areas/targets/prepare/cd_construct_long_soi_data_file.qmd b/tmd/areas/targets/prepare/cd_construct_long_soi_data_file.qmd index 28571f8b..dbaa1999 100644 --- a/tmd/areas/targets/prepare/cd_construct_long_soi_data_file.qmd +++ b/tmd/areas/targets/prepare/cd_construct_long_soi_data_file.qmd @@ -127,9 +127,16 @@ count(data, CONG_DISTRICT) # max is 53 ``` +Clean SOI CD data: + +- create record-type variable +- add agi bin labels and bounds +- + ```{r} #| label: clean-save-cddata-wide #| eval: true +#| output: false # cleaning and reshaping: # - determine record type From 858c781cec431b8c8c2f5cd807a0cd21a4ed84cb Mon Sep 17 00:00:00 2001 From: donboyd5 Date: Thu, 31 Oct 2024 07:06:26 -0400 Subject: [PATCH 21/24] update documentation for creating SOI Congressional Districts long file --- .../prepare/cd_construct_long_soi_data_file.qmd | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tmd/areas/targets/prepare/cd_construct_long_soi_data_file.qmd b/tmd/areas/targets/prepare/cd_construct_long_soi_data_file.qmd index dbaa1999..692ae223 100644 --- a/tmd/areas/targets/prepare/cd_construct_long_soi_data_file.qmd +++ b/tmd/areas/targets/prepare/cd_construct_long_soi_data_file.qmd @@ -6,7 +6,9 @@ editor_options: # Parse the Congressional District data -Clean the SOI Congressional District data and save as a long file. +Goal: create a 117th CD data file that is almost in the form needed for targets files. + +This involves cleaning the SOI Congressional District data, adding agi bin information, adding variable documentation, and saving as a long file. ## Setup @@ -185,6 +187,10 @@ rm(data, data2, cdnums) ## Create long SOI data file +- convert to a long file +- merge with variable documenttion file +- save as "cddata_long_clean.csv" in intermediate file directory + ```{r} #| label: create-save-soi-cddata-long #| eval: true @@ -198,8 +204,6 @@ glimpse(doc) idvars <- c("rectype", "ndist", "STATEFIPS", "STATE", "CONG_DISTRICT", "AGI_STUB", "agirange", "agilo", "agihi") -# TODO: put amount units in dollars!! - dlong1 <- cdwide |> pivot_longer(cols = -all_of(idvars), names_to = "vname") |> @@ -207,6 +211,7 @@ dlong1 <- cdwide |> select(vname, description, reference, vtype, basevname), by = join_by(vname)) +glimpse(dlong1) count(dlong1, vname) count(dlong1, vtype) From a6466f9ca44210625ad807384492dc41b00494dc Mon Sep 17 00:00:00 2001 From: donboyd5 Date: Thu, 31 Oct 2024 07:20:59 -0400 Subject: [PATCH 22/24] add renv-related files --- .gitignore | 3 +- tmd/areas/targets/prepare/.Rprofile | 1 + tmd/areas/targets/prepare/R/libraries.R | 2 + tmd/areas/targets/prepare/renv.lock | 1992 ++++++++++++++++++ tmd/areas/targets/prepare/renv/.gitignore | 7 + tmd/areas/targets/prepare/renv/activate.R | 1305 ++++++++++++ tmd/areas/targets/prepare/renv/settings.json | 19 + tmd/areas/targets/prepare/tools/renv_notes.R | 14 + 8 files changed, 3342 insertions(+), 1 deletion(-) create mode 100644 tmd/areas/targets/prepare/.Rprofile create mode 100644 tmd/areas/targets/prepare/renv.lock create mode 100644 tmd/areas/targets/prepare/renv/.gitignore create mode 100644 tmd/areas/targets/prepare/renv/activate.R create mode 100644 tmd/areas/targets/prepare/renv/settings.json create mode 100644 tmd/areas/targets/prepare/tools/renv_notes.R diff --git a/.gitignore b/.gitignore index 402e2307..9be8412f 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,5 @@ tmd/storage/output/tax_expenditures !tmd/areas/targets/*.csv **demographics_2015.csv **puf_2015.csv -*.DS_STORE \ No newline at end of file +*.DS_STORE +.Rproj.user diff --git a/tmd/areas/targets/prepare/.Rprofile b/tmd/areas/targets/prepare/.Rprofile new file mode 100644 index 00000000..81b960f5 --- /dev/null +++ b/tmd/areas/targets/prepare/.Rprofile @@ -0,0 +1 @@ +source("renv/activate.R") diff --git a/tmd/areas/targets/prepare/R/libraries.R b/tmd/areas/targets/prepare/R/libraries.R index 8b97d47f..ec03d8d9 100644 --- a/tmd/areas/targets/prepare/R/libraries.R +++ b/tmd/areas/targets/prepare/R/libraries.R @@ -1,5 +1,7 @@ # libraries --------------------------------------------------------------- +library(renv) + library(DT) library(fs) library(gt) diff --git a/tmd/areas/targets/prepare/renv.lock b/tmd/areas/targets/prepare/renv.lock new file mode 100644 index 00000000..2049b33b --- /dev/null +++ b/tmd/areas/targets/prepare/renv.lock @@ -0,0 +1,1992 @@ +{ + "R": { + "Version": "4.4.1", + "Repositories": [ + { + "Name": "CRAN", + "URL": "https://cloud.r-project.org" + } + ] + }, + "Packages": { + "DBI": { + "Package": "DBI", + "Version": "1.2.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "methods" + ], + "Hash": "065ae649b05f1ff66bb0c793107508f5" + }, + "DT": { + "Package": "DT", + "Version": "0.33", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "crosstalk", + "htmltools", + "htmlwidgets", + "httpuv", + "jquerylib", + "jsonlite", + "magrittr", + "promises" + ], + "Hash": "64ff3427f559ce3f2597a4fe13255cb6" + }, + "KernSmooth": { + "Package": "KernSmooth", + "Version": "2.23-24", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "stats" + ], + "Hash": "9f33a1ee37bbe8919eb2ec4b9f2473a5" + }, + "MASS": { + "Package": "MASS", + "Version": "7.3-61", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "grDevices", + "graphics", + "methods", + "stats", + "utils" + ], + "Hash": "0cafd6f0500e5deba33be22c46bf6055" + }, + "Matrix": { + "Package": "Matrix", + "Version": "1.7-1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "grDevices", + "graphics", + "grid", + "lattice", + "methods", + "stats", + "utils" + ], + "Hash": "5122bb14d8736372411f955e1b16bc8a" + }, + "R6": { + "Package": "R6", + "Version": "2.5.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "470851b6d5d0ac559e9d01bb352b4021" + }, + "RColorBrewer": { + "Package": "RColorBrewer", + "Version": "1.1-3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "45f0398006e83a5b10b72a90663d8d8c" + }, + "Rcpp": { + "Package": "Rcpp", + "Version": "1.0.13", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "methods", + "utils" + ], + "Hash": "f27411eb6d9c3dada5edd444b8416675" + }, + "V8": { + "Package": "V8", + "Version": "6.0.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "Rcpp", + "curl", + "jsonlite", + "utils" + ], + "Hash": "6603bfcbc7883a5fed41fb13042a3899" + }, + "askpass": { + "Package": "askpass", + "Version": "1.2.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "sys" + ], + "Hash": "c39f4155b3ceb1a9a2799d700fbd4b6a" + }, + "backports": { + "Package": "backports", + "Version": "1.5.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "e1e1b9d75c37401117b636b7ae50827a" + }, + "base64enc": { + "Package": "base64enc", + "Version": "0.1-3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "543776ae6848fde2f48ff3816d0628bc" + }, + "bigD": { + "Package": "bigD", + "Version": "0.2.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "93637e906f3fe962413912c956eb44db" + }, + "bit": { + "Package": "bit", + "Version": "4.5.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "5dc7b2677d65d0e874fc4aaf0e879987" + }, + "bit64": { + "Package": "bit64", + "Version": "4.5.2", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "bit", + "methods", + "stats", + "utils" + ], + "Hash": "e84984bf5f12a18628d9a02322128dfd" + }, + "bitops": { + "Package": "bitops", + "Version": "1.0-9", + "Source": "Repository", + "Repository": "CRAN", + "Hash": "d972ef991d58c19e6efa71b21f5e144b" + }, + "blob": { + "Package": "blob", + "Version": "1.2.4", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "methods", + "rlang", + "vctrs" + ], + "Hash": "40415719b5a479b87949f3aa0aee737c" + }, + "broom": { + "Package": "broom", + "Version": "1.0.7", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "backports", + "dplyr", + "generics", + "glue", + "lifecycle", + "purrr", + "rlang", + "stringr", + "tibble", + "tidyr" + ], + "Hash": "8fcc818f3b9887aebaf206f141437cc9" + }, + "bslib": { + "Package": "bslib", + "Version": "0.8.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "base64enc", + "cachem", + "fastmap", + "grDevices", + "htmltools", + "jquerylib", + "jsonlite", + "lifecycle", + "memoise", + "mime", + "rlang", + "sass" + ], + "Hash": "b299c6741ca9746fb227debcb0f9fb6c" + }, + "cachem": { + "Package": "cachem", + "Version": "1.1.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "fastmap", + "rlang" + ], + "Hash": "cd9a672193789068eb5a2aad65a0dedf" + }, + "callr": { + "Package": "callr", + "Version": "3.7.6", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "R6", + "processx", + "utils" + ], + "Hash": "d7e13f49c19103ece9e58ad2d83a7354" + }, + "cellranger": { + "Package": "cellranger", + "Version": "1.1.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "rematch", + "tibble" + ], + "Hash": "f61dbaec772ccd2e17705c1e872e9e7c" + }, + "class": { + "Package": "class", + "Version": "7.3-22", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "MASS", + "R", + "stats", + "utils" + ], + "Hash": "f91f6b29f38b8c280f2b9477787d4bb2" + }, + "classInt": { + "Package": "classInt", + "Version": "0.4-10", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "KernSmooth", + "R", + "class", + "e1071", + "grDevices", + "graphics", + "stats" + ], + "Hash": "f5a40793b1ae463a7ffb3902a95bf864" + }, + "cli": { + "Package": "cli", + "Version": "3.6.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "utils" + ], + "Hash": "b21916dd77a27642b447374a5d30ecf3" + }, + "clipr": { + "Package": "clipr", + "Version": "0.8.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "utils" + ], + "Hash": "3f038e5ac7f41d4ac41ce658c85e3042" + }, + "colorspace": { + "Package": "colorspace", + "Version": "2.1-1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "grDevices", + "graphics", + "methods", + "stats" + ], + "Hash": "d954cb1c57e8d8b756165d7ba18aa55a" + }, + "commonmark": { + "Package": "commonmark", + "Version": "1.9.2", + "Source": "Repository", + "Repository": "CRAN", + "Hash": "14eb0596f987c71535d07c3aff814742" + }, + "conflicted": { + "Package": "conflicted", + "Version": "1.2.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cli", + "memoise", + "rlang" + ], + "Hash": "bb097fccb22d156624fd07cd2894ddb6" + }, + "cpp11": { + "Package": "cpp11", + "Version": "0.5.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "91570bba75d0c9d3f1040c835cee8fba" + }, + "crayon": { + "Package": "crayon", + "Version": "1.5.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "grDevices", + "methods", + "utils" + ], + "Hash": "859d96e65ef198fd43e82b9628d593ef" + }, + "crosstalk": { + "Package": "crosstalk", + "Version": "1.2.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R6", + "htmltools", + "jsonlite", + "lazyeval" + ], + "Hash": "ab12c7b080a57475248a30f4db6298c0" + }, + "curl": { + "Package": "curl", + "Version": "5.2.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "d91263322a58af798f6cf3b13fd56dde" + }, + "data.table": { + "Package": "data.table", + "Version": "1.16.2", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "methods" + ], + "Hash": "2e00b378fc3be69c865120d9f313039a" + }, + "dbplyr": { + "Package": "dbplyr", + "Version": "2.5.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "DBI", + "R", + "R6", + "blob", + "cli", + "dplyr", + "glue", + "lifecycle", + "magrittr", + "methods", + "pillar", + "purrr", + "rlang", + "tibble", + "tidyr", + "tidyselect", + "utils", + "vctrs", + "withr" + ], + "Hash": "39b2e002522bfd258039ee4e889e0fd1" + }, + "digest": { + "Package": "digest", + "Version": "0.6.37", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "utils" + ], + "Hash": "33698c4b3127fc9f506654607fb73676" + }, + "dplyr": { + "Package": "dplyr", + "Version": "1.1.4", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "R6", + "cli", + "generics", + "glue", + "lifecycle", + "magrittr", + "methods", + "pillar", + "rlang", + "tibble", + "tidyselect", + "utils", + "vctrs" + ], + "Hash": "fedd9d00c2944ff00a0e2696ccf048ec" + }, + "dtplyr": { + "Package": "dtplyr", + "Version": "1.3.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cli", + "data.table", + "dplyr", + "glue", + "lifecycle", + "rlang", + "tibble", + "tidyselect", + "vctrs" + ], + "Hash": "54ed3ea01b11e81a86544faaecfef8e2" + }, + "e1071": { + "Package": "e1071", + "Version": "1.7-16", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "class", + "grDevices", + "graphics", + "methods", + "proxy", + "stats", + "utils" + ], + "Hash": "27a09ca40266a1066d62ef5402dd51d6" + }, + "evaluate": { + "Package": "evaluate", + "Version": "1.0.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "3fd29944b231036ad67c3edb32e02201" + }, + "fansi": { + "Package": "fansi", + "Version": "1.0.6", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "grDevices", + "utils" + ], + "Hash": "962174cf2aeb5b9eea581522286a911f" + }, + "farver": { + "Package": "farver", + "Version": "2.1.2", + "Source": "Repository", + "Repository": "CRAN", + "Hash": "680887028577f3fa2a81e410ed0d6e42" + }, + "fastmap": { + "Package": "fastmap", + "Version": "1.2.0", + "Source": "Repository", + "Repository": "CRAN", + "Hash": "aa5e1cd11c2d15497494c5292d7ffcc8" + }, + "fontawesome": { + "Package": "fontawesome", + "Version": "0.5.2", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "htmltools", + "rlang" + ], + "Hash": "c2efdd5f0bcd1ea861c2d4e2a883a67d" + }, + "forcats": { + "Package": "forcats", + "Version": "1.0.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cli", + "glue", + "lifecycle", + "magrittr", + "rlang", + "tibble" + ], + "Hash": "1a0a9a3d5083d0d573c4214576f1e690" + }, + "fs": { + "Package": "fs", + "Version": "1.6.5", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "methods" + ], + "Hash": "7f48af39fa27711ea5fbd183b399920d" + }, + "gargle": { + "Package": "gargle", + "Version": "1.5.2", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cli", + "fs", + "glue", + "httr", + "jsonlite", + "lifecycle", + "openssl", + "rappdirs", + "rlang", + "stats", + "utils", + "withr" + ], + "Hash": "fc0b272e5847c58cd5da9b20eedbd026" + }, + "generics": { + "Package": "generics", + "Version": "0.1.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "methods" + ], + "Hash": "15e9634c0fcd294799e9b2e929ed1b86" + }, + "ggplot2": { + "Package": "ggplot2", + "Version": "3.5.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "MASS", + "R", + "cli", + "glue", + "grDevices", + "grid", + "gtable", + "isoband", + "lifecycle", + "mgcv", + "rlang", + "scales", + "stats", + "tibble", + "vctrs", + "withr" + ], + "Hash": "44c6a2f8202d5b7e878ea274b1092426" + }, + "glue": { + "Package": "glue", + "Version": "1.8.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "methods" + ], + "Hash": "5899f1eaa825580172bb56c08266f37c" + }, + "googledrive": { + "Package": "googledrive", + "Version": "2.1.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cli", + "gargle", + "glue", + "httr", + "jsonlite", + "lifecycle", + "magrittr", + "pillar", + "purrr", + "rlang", + "tibble", + "utils", + "uuid", + "vctrs", + "withr" + ], + "Hash": "e99641edef03e2a5e87f0a0b1fcc97f4" + }, + "googlesheets4": { + "Package": "googlesheets4", + "Version": "1.1.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cellranger", + "cli", + "curl", + "gargle", + "glue", + "googledrive", + "httr", + "ids", + "lifecycle", + "magrittr", + "methods", + "purrr", + "rematch2", + "rlang", + "tibble", + "utils", + "vctrs", + "withr" + ], + "Hash": "d6db1667059d027da730decdc214b959" + }, + "gt": { + "Package": "gt", + "Version": "0.11.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "base64enc", + "bigD", + "bitops", + "cli", + "commonmark", + "dplyr", + "fs", + "glue", + "htmltools", + "htmlwidgets", + "juicyjuice", + "magrittr", + "markdown", + "reactable", + "rlang", + "sass", + "scales", + "tidyselect", + "vctrs", + "xml2" + ], + "Hash": "3170d1f0f45e531c241179ab57cd30bd" + }, + "gtable": { + "Package": "gtable", + "Version": "0.3.6", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cli", + "glue", + "grid", + "lifecycle", + "rlang", + "stats" + ], + "Hash": "de949855009e2d4d0e52a844e30617ae" + }, + "haven": { + "Package": "haven", + "Version": "2.5.4", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cli", + "cpp11", + "forcats", + "hms", + "lifecycle", + "methods", + "readr", + "rlang", + "tibble", + "tidyselect", + "vctrs" + ], + "Hash": "9171f898db9d9c4c1b2c745adc2c1ef1" + }, + "here": { + "Package": "here", + "Version": "1.0.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "rprojroot" + ], + "Hash": "24b224366f9c2e7534d2344d10d59211" + }, + "highr": { + "Package": "highr", + "Version": "0.11", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "xfun" + ], + "Hash": "d65ba49117ca223614f71b60d85b8ab7" + }, + "hms": { + "Package": "hms", + "Version": "1.1.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "lifecycle", + "methods", + "pkgconfig", + "rlang", + "vctrs" + ], + "Hash": "b59377caa7ed00fa41808342002138f9" + }, + "htmltools": { + "Package": "htmltools", + "Version": "0.5.8.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "base64enc", + "digest", + "fastmap", + "grDevices", + "rlang", + "utils" + ], + "Hash": "81d371a9cc60640e74e4ab6ac46dcedc" + }, + "htmlwidgets": { + "Package": "htmlwidgets", + "Version": "1.6.4", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "grDevices", + "htmltools", + "jsonlite", + "knitr", + "rmarkdown", + "yaml" + ], + "Hash": "04291cc45198225444a397606810ac37" + }, + "httpuv": { + "Package": "httpuv", + "Version": "1.6.15", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "R6", + "Rcpp", + "later", + "promises", + "utils" + ], + "Hash": "d55aa087c47a63ead0f6fc10f8fa1ee0" + }, + "httr": { + "Package": "httr", + "Version": "1.4.7", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "R6", + "curl", + "jsonlite", + "mime", + "openssl" + ], + "Hash": "ac107251d9d9fd72f0ca8049988f1d7f" + }, + "ids": { + "Package": "ids", + "Version": "1.0.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "openssl", + "uuid" + ], + "Hash": "99df65cfef20e525ed38c3d2577f7190" + }, + "isoband": { + "Package": "isoband", + "Version": "0.2.7", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "grid", + "utils" + ], + "Hash": "0080607b4a1a7b28979aecef976d8bc2" + }, + "janitor": { + "Package": "janitor", + "Version": "2.2.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "dplyr", + "hms", + "lifecycle", + "lubridate", + "magrittr", + "purrr", + "rlang", + "snakecase", + "stringi", + "stringr", + "tidyr", + "tidyselect" + ], + "Hash": "5baae149f1082f466df9d1442ba7aa65" + }, + "jquerylib": { + "Package": "jquerylib", + "Version": "0.1.4", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "htmltools" + ], + "Hash": "5aab57a3bd297eee1c1d862735972182" + }, + "jsonlite": { + "Package": "jsonlite", + "Version": "1.8.9", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "methods" + ], + "Hash": "4e993b65c2c3ffbffce7bb3e2c6f832b" + }, + "juicyjuice": { + "Package": "juicyjuice", + "Version": "0.1.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "V8" + ], + "Hash": "3bcd11943da509341838da9399e18bce" + }, + "knitr": { + "Package": "knitr", + "Version": "1.48", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "evaluate", + "highr", + "methods", + "tools", + "xfun", + "yaml" + ], + "Hash": "acf380f300c721da9fde7df115a5f86f" + }, + "labeling": { + "Package": "labeling", + "Version": "0.4.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "graphics", + "stats" + ], + "Hash": "b64ec208ac5bc1852b285f665d6368b3" + }, + "later": { + "Package": "later", + "Version": "1.3.2", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "Rcpp", + "rlang" + ], + "Hash": "a3e051d405326b8b0012377434c62b37" + }, + "lattice": { + "Package": "lattice", + "Version": "0.22-5", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "grDevices", + "graphics", + "grid", + "stats", + "utils" + ], + "Hash": "7c5e89f04e72d6611c77451f6331a091" + }, + "lazyeval": { + "Package": "lazyeval", + "Version": "0.2.2", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "d908914ae53b04d4c0c0fd72ecc35370" + }, + "lifecycle": { + "Package": "lifecycle", + "Version": "1.0.4", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cli", + "glue", + "rlang" + ], + "Hash": "b8552d117e1b808b09a832f589b79035" + }, + "lubridate": { + "Package": "lubridate", + "Version": "1.9.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "generics", + "methods", + "timechange" + ], + "Hash": "680ad542fbcf801442c83a6ac5a2126c" + }, + "magrittr": { + "Package": "magrittr", + "Version": "2.0.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "7ce2733a9826b3aeb1775d56fd305472" + }, + "markdown": { + "Package": "markdown", + "Version": "1.13", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "commonmark", + "utils", + "xfun" + ], + "Hash": "074efab766a9d6360865ad39512f2a7e" + }, + "memoise": { + "Package": "memoise", + "Version": "2.0.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "cachem", + "rlang" + ], + "Hash": "e2817ccf4a065c5d9d7f2cfbe7c1d78c" + }, + "mgcv": { + "Package": "mgcv", + "Version": "1.9-1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "Matrix", + "R", + "graphics", + "methods", + "nlme", + "splines", + "stats", + "utils" + ], + "Hash": "110ee9d83b496279960e162ac97764ce" + }, + "mime": { + "Package": "mime", + "Version": "0.12", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "tools" + ], + "Hash": "18e9c28c1d3ca1560ce30658b22ce104" + }, + "modelr": { + "Package": "modelr", + "Version": "0.1.11", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "broom", + "magrittr", + "purrr", + "rlang", + "tibble", + "tidyr", + "tidyselect", + "vctrs" + ], + "Hash": "4f50122dc256b1b6996a4703fecea821" + }, + "munsell": { + "Package": "munsell", + "Version": "0.5.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "colorspace", + "methods" + ], + "Hash": "4fd8900853b746af55b81fda99da7695" + }, + "nlme": { + "Package": "nlme", + "Version": "3.1-165", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "graphics", + "lattice", + "stats", + "utils" + ], + "Hash": "2769a88be217841b1f33ed469675c3cc" + }, + "openssl": { + "Package": "openssl", + "Version": "2.2.2", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "askpass" + ], + "Hash": "d413e0fef796c9401a4419485f709ca1" + }, + "pillar": { + "Package": "pillar", + "Version": "1.9.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "cli", + "fansi", + "glue", + "lifecycle", + "rlang", + "utf8", + "utils", + "vctrs" + ], + "Hash": "15da5a8412f317beeee6175fbc76f4bb" + }, + "pkgconfig": { + "Package": "pkgconfig", + "Version": "2.0.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "utils" + ], + "Hash": "01f28d4278f15c76cddbea05899c5d6f" + }, + "prettyunits": { + "Package": "prettyunits", + "Version": "1.2.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "6b01fc98b1e86c4f705ce9dcfd2f57c7" + }, + "processx": { + "Package": "processx", + "Version": "3.8.4", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "R6", + "ps", + "utils" + ], + "Hash": "0c90a7d71988856bad2a2a45dd871bb9" + }, + "progress": { + "Package": "progress", + "Version": "1.2.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "R6", + "crayon", + "hms", + "prettyunits" + ], + "Hash": "f4625e061cb2865f111b47ff163a5ca6" + }, + "promises": { + "Package": "promises", + "Version": "1.3.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R6", + "Rcpp", + "fastmap", + "later", + "magrittr", + "rlang", + "stats" + ], + "Hash": "434cd5388a3979e74be5c219bcd6e77d" + }, + "proxy": { + "Package": "proxy", + "Version": "0.4-27", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "stats", + "utils" + ], + "Hash": "e0ef355c12942cf7a6b91a6cfaea8b3e" + }, + "ps": { + "Package": "ps", + "Version": "1.8.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "utils" + ], + "Hash": "b4404b1de13758dea1c0484ad0d48563" + }, + "purrr": { + "Package": "purrr", + "Version": "1.0.2", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cli", + "lifecycle", + "magrittr", + "rlang", + "vctrs" + ], + "Hash": "1cba04a4e9414bdefc9dcaa99649a8dc" + }, + "ragg": { + "Package": "ragg", + "Version": "1.3.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "systemfonts", + "textshaping" + ], + "Hash": "0595fe5e47357111f29ad19101c7d271" + }, + "rappdirs": { + "Package": "rappdirs", + "Version": "0.3.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "5e3c5dc0b071b21fa128676560dbe94d" + }, + "reactR": { + "Package": "reactR", + "Version": "0.6.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "htmltools" + ], + "Hash": "b8e3d93f508045812f47136c7c44c251" + }, + "reactable": { + "Package": "reactable", + "Version": "0.4.4", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "digest", + "htmltools", + "htmlwidgets", + "jsonlite", + "reactR" + ], + "Hash": "6069eb2a6597963eae0605c1875ff14c" + }, + "readr": { + "Package": "readr", + "Version": "2.1.5", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "R6", + "cli", + "clipr", + "cpp11", + "crayon", + "hms", + "lifecycle", + "methods", + "rlang", + "tibble", + "tzdb", + "utils", + "vroom" + ], + "Hash": "9de96463d2117f6ac49980577939dfb3" + }, + "readxl": { + "Package": "readxl", + "Version": "1.4.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cellranger", + "cpp11", + "progress", + "tibble", + "utils" + ], + "Hash": "8cf9c239b96df1bbb133b74aef77ad0a" + }, + "rematch": { + "Package": "rematch", + "Version": "2.0.0", + "Source": "Repository", + "Repository": "CRAN", + "Hash": "cbff1b666c6fa6d21202f07e2318d4f1" + }, + "rematch2": { + "Package": "rematch2", + "Version": "2.1.2", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "tibble" + ], + "Hash": "76c9e04c712a05848ae7a23d2f170a40" + }, + "renv": { + "Package": "renv", + "Version": "1.0.11", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "utils" + ], + "Hash": "47623f66b4e80b3b0587bc5d7b309888" + }, + "repr": { + "Package": "repr", + "Version": "1.1.7", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "base64enc", + "grDevices", + "htmltools", + "jsonlite", + "pillar", + "utils" + ], + "Hash": "1393acc49816f4fe143d87fb33e75631" + }, + "reprex": { + "Package": "reprex", + "Version": "2.1.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "callr", + "cli", + "clipr", + "fs", + "glue", + "knitr", + "lifecycle", + "rlang", + "rmarkdown", + "rstudioapi", + "utils", + "withr" + ], + "Hash": "97b1d5361a24d9fb588db7afe3e5bcbf" + }, + "rlang": { + "Package": "rlang", + "Version": "1.1.4", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "utils" + ], + "Hash": "3eec01f8b1dee337674b2e34ab1f9bc1" + }, + "rmarkdown": { + "Package": "rmarkdown", + "Version": "2.28", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "bslib", + "evaluate", + "fontawesome", + "htmltools", + "jquerylib", + "jsonlite", + "knitr", + "methods", + "tinytex", + "tools", + "utils", + "xfun", + "yaml" + ], + "Hash": "062470668513dcda416927085ee9bdc7" + }, + "rprojroot": { + "Package": "rprojroot", + "Version": "2.0.4", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "4c8415e0ec1e29f3f4f6fc108bef0144" + }, + "rstudioapi": { + "Package": "rstudioapi", + "Version": "0.17.1", + "Source": "Repository", + "Repository": "CRAN", + "Hash": "5f90cd73946d706cfe26024294236113" + }, + "rvest": { + "Package": "rvest", + "Version": "1.0.4", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cli", + "glue", + "httr", + "lifecycle", + "magrittr", + "rlang", + "selectr", + "tibble", + "xml2" + ], + "Hash": "0bcf0c6f274e90ea314b812a6d19a519" + }, + "s2": { + "Package": "s2", + "Version": "1.1.7", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "Rcpp", + "wk" + ], + "Hash": "3c8013cdd7f1d20de5762e3f97e5e274" + }, + "sass": { + "Package": "sass", + "Version": "0.4.9", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R6", + "fs", + "htmltools", + "rappdirs", + "rlang" + ], + "Hash": "d53dbfddf695303ea4ad66f86e99b95d" + }, + "scales": { + "Package": "scales", + "Version": "1.3.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "R6", + "RColorBrewer", + "cli", + "farver", + "glue", + "labeling", + "lifecycle", + "munsell", + "rlang", + "viridisLite" + ], + "Hash": "c19df082ba346b0ffa6f833e92de34d1" + }, + "selectr": { + "Package": "selectr", + "Version": "0.4-2", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "R6", + "methods", + "stringr" + ], + "Hash": "3838071b66e0c566d55cc26bd6e27bf4" + }, + "sf": { + "Package": "sf", + "Version": "1.0-18", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "DBI", + "R", + "Rcpp", + "classInt", + "grDevices", + "graphics", + "grid", + "magrittr", + "methods", + "s2", + "stats", + "tools", + "units", + "utils" + ], + "Hash": "801bec14b3bae0f37eef4d187ee0bb44" + }, + "skimr": { + "Package": "skimr", + "Version": "2.1.5", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cli", + "dplyr", + "knitr", + "magrittr", + "pillar", + "purrr", + "repr", + "rlang", + "stats", + "stringr", + "tibble", + "tidyr", + "tidyselect", + "vctrs" + ], + "Hash": "8f138ff2c8fbea9e0a523f6c399c0386" + }, + "snakecase": { + "Package": "snakecase", + "Version": "0.11.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "stringi", + "stringr" + ], + "Hash": "58767e44739b76965332e8a4fe3f91f1" + }, + "stringi": { + "Package": "stringi", + "Version": "1.8.4", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "stats", + "tools", + "utils" + ], + "Hash": "39e1144fd75428983dc3f63aa53dfa91" + }, + "stringr": { + "Package": "stringr", + "Version": "1.5.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cli", + "glue", + "lifecycle", + "magrittr", + "rlang", + "stringi", + "vctrs" + ], + "Hash": "960e2ae9e09656611e0b8214ad543207" + }, + "sys": { + "Package": "sys", + "Version": "3.4.3", + "Source": "Repository", + "Repository": "CRAN", + "Hash": "de342ebfebdbf40477d0758d05426646" + }, + "systemfonts": { + "Package": "systemfonts", + "Version": "1.1.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cpp11", + "lifecycle" + ], + "Hash": "213b6b8ed5afbf934843e6c3b090d418" + }, + "textshaping": { + "Package": "textshaping", + "Version": "0.4.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cpp11", + "lifecycle", + "systemfonts" + ], + "Hash": "5142f8bc78ed3d819d26461b641627ce" + }, + "tibble": { + "Package": "tibble", + "Version": "3.2.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "fansi", + "lifecycle", + "magrittr", + "methods", + "pillar", + "pkgconfig", + "rlang", + "utils", + "vctrs" + ], + "Hash": "a84e2cc86d07289b3b6f5069df7a004c" + }, + "tidycensus": { + "Package": "tidycensus", + "Version": "1.6.7", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "crayon", + "dplyr", + "httr", + "jsonlite", + "purrr", + "rappdirs", + "readr", + "rlang", + "rvest", + "sf", + "stringr", + "tidyr", + "tidyselect", + "tigris", + "units", + "utils", + "xml2" + ], + "Hash": "dc9899377067fb70fd35f5278946dde3" + }, + "tidyr": { + "Package": "tidyr", + "Version": "1.3.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cli", + "cpp11", + "dplyr", + "glue", + "lifecycle", + "magrittr", + "purrr", + "rlang", + "stringr", + "tibble", + "tidyselect", + "utils", + "vctrs" + ], + "Hash": "915fb7ce036c22a6a33b5a8adb712eb1" + }, + "tidyselect": { + "Package": "tidyselect", + "Version": "1.2.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cli", + "glue", + "lifecycle", + "rlang", + "vctrs", + "withr" + ], + "Hash": "829f27b9c4919c16b593794a6344d6c0" + }, + "tidyverse": { + "Package": "tidyverse", + "Version": "2.0.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "broom", + "cli", + "conflicted", + "dbplyr", + "dplyr", + "dtplyr", + "forcats", + "ggplot2", + "googledrive", + "googlesheets4", + "haven", + "hms", + "httr", + "jsonlite", + "lubridate", + "magrittr", + "modelr", + "pillar", + "purrr", + "ragg", + "readr", + "readxl", + "reprex", + "rlang", + "rstudioapi", + "rvest", + "stringr", + "tibble", + "tidyr", + "xml2" + ], + "Hash": "c328568cd14ea89a83bd4ca7f54ae07e" + }, + "tigris": { + "Package": "tigris", + "Version": "2.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "dplyr", + "httr", + "magrittr", + "methods", + "rappdirs", + "sf", + "stringr", + "utils", + "uuid" + ], + "Hash": "d750d0f06536d915f01d433254451204" + }, + "timechange": { + "Package": "timechange", + "Version": "0.3.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cpp11" + ], + "Hash": "c5f3c201b931cd6474d17d8700ccb1c8" + }, + "tinytex": { + "Package": "tinytex", + "Version": "0.53", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "xfun" + ], + "Hash": "9db859e8aabbb474293dde3097839420" + }, + "tzdb": { + "Package": "tzdb", + "Version": "0.4.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cpp11" + ], + "Hash": "f561504ec2897f4d46f0c7657e488ae1" + }, + "units": { + "Package": "units", + "Version": "0.8-5", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "Rcpp" + ], + "Hash": "119d19da480e873f72241ff6962ffd83" + }, + "utf8": { + "Package": "utf8", + "Version": "1.2.4", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "62b65c52671e6665f803ff02954446e9" + }, + "uuid": { + "Package": "uuid", + "Version": "1.2-1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "34e965e62a41fcafb1ca60e9b142085b" + }, + "vctrs": { + "Package": "vctrs", + "Version": "0.6.5", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cli", + "glue", + "lifecycle", + "rlang" + ], + "Hash": "c03fa420630029418f7e6da3667aac4a" + }, + "viridisLite": { + "Package": "viridisLite", + "Version": "0.4.2", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "c826c7c4241b6fc89ff55aaea3fa7491" + }, + "vroom": { + "Package": "vroom", + "Version": "1.6.5", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "bit64", + "cli", + "cpp11", + "crayon", + "glue", + "hms", + "lifecycle", + "methods", + "progress", + "rlang", + "stats", + "tibble", + "tidyselect", + "tzdb", + "vctrs", + "withr" + ], + "Hash": "390f9315bc0025be03012054103d227c" + }, + "withr": { + "Package": "withr", + "Version": "3.0.2", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "grDevices", + "graphics" + ], + "Hash": "cc2d62c76458d425210d1eb1478b30b4" + }, + "wk": { + "Package": "wk", + "Version": "0.9.4", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "37be35d733130f1de1ef51672cf7cdc0" + }, + "xfun": { + "Package": "xfun", + "Version": "0.48", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "grDevices", + "stats", + "tools" + ], + "Hash": "89e455b87c84e227eb7f60a1b4e5fe1f" + }, + "xml2": { + "Package": "xml2", + "Version": "1.3.6", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cli", + "methods", + "rlang" + ], + "Hash": "1d0336142f4cd25d8d23cd3ba7a8fb61" + }, + "yaml": { + "Package": "yaml", + "Version": "2.3.10", + "Source": "Repository", + "Repository": "CRAN", + "Hash": "51dab85c6c98e50a18d7551e9d49f76c" + } + } +} diff --git a/tmd/areas/targets/prepare/renv/.gitignore b/tmd/areas/targets/prepare/renv/.gitignore new file mode 100644 index 00000000..0ec0cbba --- /dev/null +++ b/tmd/areas/targets/prepare/renv/.gitignore @@ -0,0 +1,7 @@ +library/ +local/ +cellar/ +lock/ +python/ +sandbox/ +staging/ diff --git a/tmd/areas/targets/prepare/renv/activate.R b/tmd/areas/targets/prepare/renv/activate.R new file mode 100644 index 00000000..0eb51088 --- /dev/null +++ b/tmd/areas/targets/prepare/renv/activate.R @@ -0,0 +1,1305 @@ + +local({ + + # the requested version of renv + version <- "1.0.11" + attr(version, "sha") <- NULL + + # the project directory + project <- Sys.getenv("RENV_PROJECT") + if (!nzchar(project)) + project <- getwd() + + # use start-up diagnostics if enabled + diagnostics <- Sys.getenv("RENV_STARTUP_DIAGNOSTICS", unset = "FALSE") + if (diagnostics) { + start <- Sys.time() + profile <- tempfile("renv-startup-", fileext = ".Rprof") + utils::Rprof(profile) + on.exit({ + utils::Rprof(NULL) + elapsed <- signif(difftime(Sys.time(), start, units = "auto"), digits = 2L) + writeLines(sprintf("- renv took %s to run the autoloader.", format(elapsed))) + writeLines(sprintf("- Profile: %s", profile)) + print(utils::summaryRprof(profile)) + }, add = TRUE) + } + + # figure out whether the autoloader is enabled + enabled <- local({ + + # first, check config option + override <- getOption("renv.config.autoloader.enabled") + if (!is.null(override)) + return(override) + + # if we're being run in a context where R_LIBS is already set, + # don't load -- presumably we're being run as a sub-process and + # the parent process has already set up library paths for us + rcmd <- Sys.getenv("R_CMD", unset = NA) + rlibs <- Sys.getenv("R_LIBS", unset = NA) + if (!is.na(rlibs) && !is.na(rcmd)) + return(FALSE) + + # next, check environment variables + # TODO: prefer using the configuration one in the future + envvars <- c( + "RENV_CONFIG_AUTOLOADER_ENABLED", + "RENV_AUTOLOADER_ENABLED", + "RENV_ACTIVATE_PROJECT" + ) + + for (envvar in envvars) { + envval <- Sys.getenv(envvar, unset = NA) + if (!is.na(envval)) + return(tolower(envval) %in% c("true", "t", "1")) + } + + # enable by default + TRUE + + }) + + # bail if we're not enabled + if (!enabled) { + + # if we're not enabled, we might still need to manually load + # the user profile here + profile <- Sys.getenv("R_PROFILE_USER", unset = "~/.Rprofile") + if (file.exists(profile)) { + cfg <- Sys.getenv("RENV_CONFIG_USER_PROFILE", unset = "TRUE") + if (tolower(cfg) %in% c("true", "t", "1")) + sys.source(profile, envir = globalenv()) + } + + return(FALSE) + + } + + # avoid recursion + if (identical(getOption("renv.autoloader.running"), TRUE)) { + warning("ignoring recursive attempt to run renv autoloader") + return(invisible(TRUE)) + } + + # signal that we're loading renv during R startup + options(renv.autoloader.running = TRUE) + on.exit(options(renv.autoloader.running = NULL), add = TRUE) + + # signal that we've consented to use renv + options(renv.consent = TRUE) + + # load the 'utils' package eagerly -- this ensures that renv shims, which + # mask 'utils' packages, will come first on the search path + library(utils, lib.loc = .Library) + + # unload renv if it's already been loaded + if ("renv" %in% loadedNamespaces()) + unloadNamespace("renv") + + # load bootstrap tools + ansify <- function(text) { + if (renv_ansify_enabled()) + renv_ansify_enhanced(text) + else + renv_ansify_default(text) + } + + renv_ansify_enabled <- function() { + + override <- Sys.getenv("RENV_ANSIFY_ENABLED", unset = NA) + if (!is.na(override)) + return(as.logical(override)) + + pane <- Sys.getenv("RSTUDIO_CHILD_PROCESS_PANE", unset = NA) + if (identical(pane, "build")) + return(FALSE) + + testthat <- Sys.getenv("TESTTHAT", unset = "false") + if (tolower(testthat) %in% "true") + return(FALSE) + + iderun <- Sys.getenv("R_CLI_HAS_HYPERLINK_IDE_RUN", unset = "false") + if (tolower(iderun) %in% "false") + return(FALSE) + + TRUE + + } + + renv_ansify_default <- function(text) { + text + } + + renv_ansify_enhanced <- function(text) { + + # R help links + pattern <- "`\\?(renv::(?:[^`])+)`" + replacement <- "`\033]8;;ide:help:\\1\a?\\1\033]8;;\a`" + text <- gsub(pattern, replacement, text, perl = TRUE) + + # runnable code + pattern <- "`(renv::(?:[^`])+)`" + replacement <- "`\033]8;;ide:run:\\1\a\\1\033]8;;\a`" + text <- gsub(pattern, replacement, text, perl = TRUE) + + # return ansified text + text + + } + + renv_ansify_init <- function() { + + envir <- renv_envir_self() + if (renv_ansify_enabled()) + assign("ansify", renv_ansify_enhanced, envir = envir) + else + assign("ansify", renv_ansify_default, envir = envir) + + } + + `%||%` <- function(x, y) { + if (is.null(x)) y else x + } + + catf <- function(fmt, ..., appendLF = TRUE) { + + quiet <- getOption("renv.bootstrap.quiet", default = FALSE) + if (quiet) + return(invisible()) + + msg <- sprintf(fmt, ...) + cat(msg, file = stdout(), sep = if (appendLF) "\n" else "") + + invisible(msg) + + } + + header <- function(label, + ..., + prefix = "#", + suffix = "-", + n = min(getOption("width"), 78)) + { + label <- sprintf(label, ...) + n <- max(n - nchar(label) - nchar(prefix) - 2L, 8L) + if (n <= 0) + return(paste(prefix, label)) + + tail <- paste(rep.int(suffix, n), collapse = "") + paste0(prefix, " ", label, " ", tail) + + } + + heredoc <- function(text, leave = 0) { + + # remove leading, trailing whitespace + trimmed <- gsub("^\\s*\\n|\\n\\s*$", "", text) + + # split into lines + lines <- strsplit(trimmed, "\n", fixed = TRUE)[[1L]] + + # compute common indent + indent <- regexpr("[^[:space:]]", lines) + common <- min(setdiff(indent, -1L)) - leave + text <- paste(substring(lines, common), collapse = "\n") + + # substitute in ANSI links for executable renv code + ansify(text) + + } + + startswith <- function(string, prefix) { + substring(string, 1, nchar(prefix)) == prefix + } + + bootstrap <- function(version, library) { + + friendly <- renv_bootstrap_version_friendly(version) + section <- header(sprintf("Bootstrapping renv %s", friendly)) + catf(section) + + # attempt to download renv + catf("- Downloading renv ... ", appendLF = FALSE) + withCallingHandlers( + tarball <- renv_bootstrap_download(version), + error = function(err) { + catf("FAILED") + stop("failed to download:\n", conditionMessage(err)) + } + ) + catf("OK") + on.exit(unlink(tarball), add = TRUE) + + # now attempt to install + catf("- Installing renv ... ", appendLF = FALSE) + withCallingHandlers( + status <- renv_bootstrap_install(version, tarball, library), + error = function(err) { + catf("FAILED") + stop("failed to install:\n", conditionMessage(err)) + } + ) + catf("OK") + + # add empty line to break up bootstrapping from normal output + catf("") + + return(invisible()) + } + + renv_bootstrap_tests_running <- function() { + getOption("renv.tests.running", default = FALSE) + } + + renv_bootstrap_repos <- function() { + + # get CRAN repository + cran <- getOption("renv.repos.cran", "https://cloud.r-project.org") + + # check for repos override + repos <- Sys.getenv("RENV_CONFIG_REPOS_OVERRIDE", unset = NA) + if (!is.na(repos)) { + + # check for RSPM; if set, use a fallback repository for renv + rspm <- Sys.getenv("RSPM", unset = NA) + if (identical(rspm, repos)) + repos <- c(RSPM = rspm, CRAN = cran) + + return(repos) + + } + + # check for lockfile repositories + repos <- tryCatch(renv_bootstrap_repos_lockfile(), error = identity) + if (!inherits(repos, "error") && length(repos)) + return(repos) + + # retrieve current repos + repos <- getOption("repos") + + # ensure @CRAN@ entries are resolved + repos[repos == "@CRAN@"] <- cran + + # add in renv.bootstrap.repos if set + default <- c(FALLBACK = "https://cloud.r-project.org") + extra <- getOption("renv.bootstrap.repos", default = default) + repos <- c(repos, extra) + + # remove duplicates that might've snuck in + dupes <- duplicated(repos) | duplicated(names(repos)) + repos[!dupes] + + } + + renv_bootstrap_repos_lockfile <- function() { + + lockpath <- Sys.getenv("RENV_PATHS_LOCKFILE", unset = "renv.lock") + if (!file.exists(lockpath)) + return(NULL) + + lockfile <- tryCatch(renv_json_read(lockpath), error = identity) + if (inherits(lockfile, "error")) { + warning(lockfile) + return(NULL) + } + + repos <- lockfile$R$Repositories + if (length(repos) == 0) + return(NULL) + + keys <- vapply(repos, `[[`, "Name", FUN.VALUE = character(1)) + vals <- vapply(repos, `[[`, "URL", FUN.VALUE = character(1)) + names(vals) <- keys + + return(vals) + + } + + renv_bootstrap_download <- function(version) { + + sha <- attr(version, "sha", exact = TRUE) + + methods <- if (!is.null(sha)) { + + # attempting to bootstrap a development version of renv + c( + function() renv_bootstrap_download_tarball(sha), + function() renv_bootstrap_download_github(sha) + ) + + } else { + + # attempting to bootstrap a release version of renv + c( + function() renv_bootstrap_download_tarball(version), + function() renv_bootstrap_download_cran_latest(version), + function() renv_bootstrap_download_cran_archive(version) + ) + + } + + for (method in methods) { + path <- tryCatch(method(), error = identity) + if (is.character(path) && file.exists(path)) + return(path) + } + + stop("All download methods failed") + + } + + renv_bootstrap_download_impl <- function(url, destfile) { + + mode <- "wb" + + # https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17715 + fixup <- + Sys.info()[["sysname"]] == "Windows" && + substring(url, 1L, 5L) == "file:" + + if (fixup) + mode <- "w+b" + + args <- list( + url = url, + destfile = destfile, + mode = mode, + quiet = TRUE + ) + + if ("headers" %in% names(formals(utils::download.file))) { + headers <- renv_bootstrap_download_custom_headers(url) + if (length(headers) && is.character(headers)) + args$headers <- headers + } + + do.call(utils::download.file, args) + + } + + renv_bootstrap_download_custom_headers <- function(url) { + + headers <- getOption("renv.download.headers") + if (is.null(headers)) + return(character()) + + if (!is.function(headers)) + stopf("'renv.download.headers' is not a function") + + headers <- headers(url) + if (length(headers) == 0L) + return(character()) + + if (is.list(headers)) + headers <- unlist(headers, recursive = FALSE, use.names = TRUE) + + ok <- + is.character(headers) && + is.character(names(headers)) && + all(nzchar(names(headers))) + + if (!ok) + stop("invocation of 'renv.download.headers' did not return a named character vector") + + headers + + } + + renv_bootstrap_download_cran_latest <- function(version) { + + spec <- renv_bootstrap_download_cran_latest_find(version) + type <- spec$type + repos <- spec$repos + + baseurl <- utils::contrib.url(repos = repos, type = type) + ext <- if (identical(type, "source")) + ".tar.gz" + else if (Sys.info()[["sysname"]] == "Windows") + ".zip" + else + ".tgz" + name <- sprintf("renv_%s%s", version, ext) + url <- paste(baseurl, name, sep = "/") + + destfile <- file.path(tempdir(), name) + status <- tryCatch( + renv_bootstrap_download_impl(url, destfile), + condition = identity + ) + + if (inherits(status, "condition")) + return(FALSE) + + # report success and return + destfile + + } + + renv_bootstrap_download_cran_latest_find <- function(version) { + + # check whether binaries are supported on this system + binary <- + getOption("renv.bootstrap.binary", default = TRUE) && + !identical(.Platform$pkgType, "source") && + !identical(getOption("pkgType"), "source") && + Sys.info()[["sysname"]] %in% c("Darwin", "Windows") + + types <- c(if (binary) "binary", "source") + + # iterate over types + repositories + for (type in types) { + for (repos in renv_bootstrap_repos()) { + + # build arguments for utils::available.packages() call + args <- list(type = type, repos = repos) + + # add custom headers if available -- note that + # utils::available.packages() will pass this to download.file() + if ("headers" %in% names(formals(utils::download.file))) { + headers <- renv_bootstrap_download_custom_headers(repos) + if (length(headers) && is.character(headers)) + args$headers <- headers + } + + # retrieve package database + db <- tryCatch( + as.data.frame( + do.call(utils::available.packages, args), + stringsAsFactors = FALSE + ), + error = identity + ) + + if (inherits(db, "error")) + next + + # check for compatible entry + entry <- db[db$Package %in% "renv" & db$Version %in% version, ] + if (nrow(entry) == 0) + next + + # found it; return spec to caller + spec <- list(entry = entry, type = type, repos = repos) + return(spec) + + } + } + + # if we got here, we failed to find renv + fmt <- "renv %s is not available from your declared package repositories" + stop(sprintf(fmt, version)) + + } + + renv_bootstrap_download_cran_archive <- function(version) { + + name <- sprintf("renv_%s.tar.gz", version) + repos <- renv_bootstrap_repos() + urls <- file.path(repos, "src/contrib/Archive/renv", name) + destfile <- file.path(tempdir(), name) + + for (url in urls) { + + status <- tryCatch( + renv_bootstrap_download_impl(url, destfile), + condition = identity + ) + + if (identical(status, 0L)) + return(destfile) + + } + + return(FALSE) + + } + + renv_bootstrap_download_tarball <- function(version) { + + # if the user has provided the path to a tarball via + # an environment variable, then use it + tarball <- Sys.getenv("RENV_BOOTSTRAP_TARBALL", unset = NA) + if (is.na(tarball)) + return() + + # allow directories + if (dir.exists(tarball)) { + name <- sprintf("renv_%s.tar.gz", version) + tarball <- file.path(tarball, name) + } + + # bail if it doesn't exist + if (!file.exists(tarball)) { + + # let the user know we weren't able to honour their request + fmt <- "- RENV_BOOTSTRAP_TARBALL is set (%s) but does not exist." + msg <- sprintf(fmt, tarball) + warning(msg) + + # bail + return() + + } + + catf("- Using local tarball '%s'.", tarball) + tarball + + } + + renv_bootstrap_github_token <- function() { + for (envvar in c("GITHUB_TOKEN", "GITHUB_PAT", "GH_TOKEN")) { + envval <- Sys.getenv(envvar, unset = NA) + if (!is.na(envval)) + return(envval) + } + } + + renv_bootstrap_download_github <- function(version) { + + enabled <- Sys.getenv("RENV_BOOTSTRAP_FROM_GITHUB", unset = "TRUE") + if (!identical(enabled, "TRUE")) + return(FALSE) + + # prepare download options + token <- renv_bootstrap_github_token() + if (nzchar(Sys.which("curl")) && nzchar(token)) { + fmt <- "--location --fail --header \"Authorization: token %s\"" + extra <- sprintf(fmt, token) + saved <- options("download.file.method", "download.file.extra") + options(download.file.method = "curl", download.file.extra = extra) + on.exit(do.call(base::options, saved), add = TRUE) + } else if (nzchar(Sys.which("wget")) && nzchar(token)) { + fmt <- "--header=\"Authorization: token %s\"" + extra <- sprintf(fmt, token) + saved <- options("download.file.method", "download.file.extra") + options(download.file.method = "wget", download.file.extra = extra) + on.exit(do.call(base::options, saved), add = TRUE) + } + + url <- file.path("https://api.github.com/repos/rstudio/renv/tarball", version) + name <- sprintf("renv_%s.tar.gz", version) + destfile <- file.path(tempdir(), name) + + status <- tryCatch( + renv_bootstrap_download_impl(url, destfile), + condition = identity + ) + + if (!identical(status, 0L)) + return(FALSE) + + renv_bootstrap_download_augment(destfile) + + return(destfile) + + } + + # Add Sha to DESCRIPTION. This is stop gap until #890, after which we + # can use renv::install() to fully capture metadata. + renv_bootstrap_download_augment <- function(destfile) { + sha <- renv_bootstrap_git_extract_sha1_tar(destfile) + if (is.null(sha)) { + return() + } + + # Untar + tempdir <- tempfile("renv-github-") + on.exit(unlink(tempdir, recursive = TRUE), add = TRUE) + untar(destfile, exdir = tempdir) + pkgdir <- dir(tempdir, full.names = TRUE)[[1]] + + # Modify description + desc_path <- file.path(pkgdir, "DESCRIPTION") + desc_lines <- readLines(desc_path) + remotes_fields <- c( + "RemoteType: github", + "RemoteHost: api.github.com", + "RemoteRepo: renv", + "RemoteUsername: rstudio", + "RemotePkgRef: rstudio/renv", + paste("RemoteRef: ", sha), + paste("RemoteSha: ", sha) + ) + writeLines(c(desc_lines[desc_lines != ""], remotes_fields), con = desc_path) + + # Re-tar + local({ + old <- setwd(tempdir) + on.exit(setwd(old), add = TRUE) + + tar(destfile, compression = "gzip") + }) + invisible() + } + + # Extract the commit hash from a git archive. Git archives include the SHA1 + # hash as the comment field of the tarball pax extended header + # (see https://www.kernel.org/pub/software/scm/git/docs/git-archive.html) + # For GitHub archives this should be the first header after the default one + # (512 byte) header. + renv_bootstrap_git_extract_sha1_tar <- function(bundle) { + + # open the bundle for reading + # We use gzcon for everything because (from ?gzcon) + # > Reading from a connection which does not supply a 'gzip' magic + # > header is equivalent to reading from the original connection + conn <- gzcon(file(bundle, open = "rb", raw = TRUE)) + on.exit(close(conn)) + + # The default pax header is 512 bytes long and the first pax extended header + # with the comment should be 51 bytes long + # `52 comment=` (11 chars) + 40 byte SHA1 hash + len <- 0x200 + 0x33 + res <- rawToChar(readBin(conn, "raw", n = len)[0x201:len]) + + if (grepl("^52 comment=", res)) { + sub("52 comment=", "", res) + } else { + NULL + } + } + + renv_bootstrap_install <- function(version, tarball, library) { + + # attempt to install it into project library + dir.create(library, showWarnings = FALSE, recursive = TRUE) + output <- renv_bootstrap_install_impl(library, tarball) + + # check for successful install + status <- attr(output, "status") + if (is.null(status) || identical(status, 0L)) + return(status) + + # an error occurred; report it + header <- "installation of renv failed" + lines <- paste(rep.int("=", nchar(header)), collapse = "") + text <- paste(c(header, lines, output), collapse = "\n") + stop(text) + + } + + renv_bootstrap_install_impl <- function(library, tarball) { + + # invoke using system2 so we can capture and report output + bin <- R.home("bin") + exe <- if (Sys.info()[["sysname"]] == "Windows") "R.exe" else "R" + R <- file.path(bin, exe) + + args <- c( + "--vanilla", "CMD", "INSTALL", "--no-multiarch", + "-l", shQuote(path.expand(library)), + shQuote(path.expand(tarball)) + ) + + system2(R, args, stdout = TRUE, stderr = TRUE) + + } + + renv_bootstrap_platform_prefix <- function() { + + # construct version prefix + version <- paste(R.version$major, R.version$minor, sep = ".") + prefix <- paste("R", numeric_version(version)[1, 1:2], sep = "-") + + # include SVN revision for development versions of R + # (to avoid sharing platform-specific artefacts with released versions of R) + devel <- + identical(R.version[["status"]], "Under development (unstable)") || + identical(R.version[["nickname"]], "Unsuffered Consequences") + + if (devel) + prefix <- paste(prefix, R.version[["svn rev"]], sep = "-r") + + # build list of path components + components <- c(prefix, R.version$platform) + + # include prefix if provided by user + prefix <- renv_bootstrap_platform_prefix_impl() + if (!is.na(prefix) && nzchar(prefix)) + components <- c(prefix, components) + + # build prefix + paste(components, collapse = "/") + + } + + renv_bootstrap_platform_prefix_impl <- function() { + + # if an explicit prefix has been supplied, use it + prefix <- Sys.getenv("RENV_PATHS_PREFIX", unset = NA) + if (!is.na(prefix)) + return(prefix) + + # if the user has requested an automatic prefix, generate it + auto <- Sys.getenv("RENV_PATHS_PREFIX_AUTO", unset = NA) + if (is.na(auto) && getRversion() >= "4.4.0") + auto <- "TRUE" + + if (auto %in% c("TRUE", "True", "true", "1")) + return(renv_bootstrap_platform_prefix_auto()) + + # empty string on failure + "" + + } + + renv_bootstrap_platform_prefix_auto <- function() { + + prefix <- tryCatch(renv_bootstrap_platform_os(), error = identity) + if (inherits(prefix, "error") || prefix %in% "unknown") { + + msg <- paste( + "failed to infer current operating system", + "please file a bug report at https://github.com/rstudio/renv/issues", + sep = "; " + ) + + warning(msg) + + } + + prefix + + } + + renv_bootstrap_platform_os <- function() { + + sysinfo <- Sys.info() + sysname <- sysinfo[["sysname"]] + + # handle Windows + macOS up front + if (sysname == "Windows") + return("windows") + else if (sysname == "Darwin") + return("macos") + + # check for os-release files + for (file in c("/etc/os-release", "/usr/lib/os-release")) + if (file.exists(file)) + return(renv_bootstrap_platform_os_via_os_release(file, sysinfo)) + + # check for redhat-release files + if (file.exists("/etc/redhat-release")) + return(renv_bootstrap_platform_os_via_redhat_release()) + + "unknown" + + } + + renv_bootstrap_platform_os_via_os_release <- function(file, sysinfo) { + + # read /etc/os-release + release <- utils::read.table( + file = file, + sep = "=", + quote = c("\"", "'"), + col.names = c("Key", "Value"), + comment.char = "#", + stringsAsFactors = FALSE + ) + + vars <- as.list(release$Value) + names(vars) <- release$Key + + # get os name + os <- tolower(sysinfo[["sysname"]]) + + # read id + id <- "unknown" + for (field in c("ID", "ID_LIKE")) { + if (field %in% names(vars) && nzchar(vars[[field]])) { + id <- vars[[field]] + break + } + } + + # read version + version <- "unknown" + for (field in c("UBUNTU_CODENAME", "VERSION_CODENAME", "VERSION_ID", "BUILD_ID")) { + if (field %in% names(vars) && nzchar(vars[[field]])) { + version <- vars[[field]] + break + } + } + + # join together + paste(c(os, id, version), collapse = "-") + + } + + renv_bootstrap_platform_os_via_redhat_release <- function() { + + # read /etc/redhat-release + contents <- readLines("/etc/redhat-release", warn = FALSE) + + # infer id + id <- if (grepl("centos", contents, ignore.case = TRUE)) + "centos" + else if (grepl("redhat", contents, ignore.case = TRUE)) + "redhat" + else + "unknown" + + # try to find a version component (very hacky) + version <- "unknown" + + parts <- strsplit(contents, "[[:space:]]")[[1L]] + for (part in parts) { + + nv <- tryCatch(numeric_version(part), error = identity) + if (inherits(nv, "error")) + next + + version <- nv[1, 1] + break + + } + + paste(c("linux", id, version), collapse = "-") + + } + + renv_bootstrap_library_root_name <- function(project) { + + # use project name as-is if requested + asis <- Sys.getenv("RENV_PATHS_LIBRARY_ROOT_ASIS", unset = "FALSE") + if (asis) + return(basename(project)) + + # otherwise, disambiguate based on project's path + id <- substring(renv_bootstrap_hash_text(project), 1L, 8L) + paste(basename(project), id, sep = "-") + + } + + renv_bootstrap_library_root <- function(project) { + + prefix <- renv_bootstrap_profile_prefix() + + path <- Sys.getenv("RENV_PATHS_LIBRARY", unset = NA) + if (!is.na(path)) + return(paste(c(path, prefix), collapse = "/")) + + path <- renv_bootstrap_library_root_impl(project) + if (!is.null(path)) { + name <- renv_bootstrap_library_root_name(project) + return(paste(c(path, prefix, name), collapse = "/")) + } + + renv_bootstrap_paths_renv("library", project = project) + + } + + renv_bootstrap_library_root_impl <- function(project) { + + root <- Sys.getenv("RENV_PATHS_LIBRARY_ROOT", unset = NA) + if (!is.na(root)) + return(root) + + type <- renv_bootstrap_project_type(project) + if (identical(type, "package")) { + userdir <- renv_bootstrap_user_dir() + return(file.path(userdir, "library")) + } + + } + + renv_bootstrap_validate_version <- function(version, description = NULL) { + + # resolve description file + # + # avoid passing lib.loc to `packageDescription()` below, since R will + # use the loaded version of the package by default anyhow. note that + # this function should only be called after 'renv' is loaded + # https://github.com/rstudio/renv/issues/1625 + description <- description %||% packageDescription("renv") + + # check whether requested version 'version' matches loaded version of renv + sha <- attr(version, "sha", exact = TRUE) + valid <- if (!is.null(sha)) + renv_bootstrap_validate_version_dev(sha, description) + else + renv_bootstrap_validate_version_release(version, description) + + if (valid) + return(TRUE) + + # the loaded version of renv doesn't match the requested version; + # give the user instructions on how to proceed + dev <- identical(description[["RemoteType"]], "github") + remote <- if (dev) + paste("rstudio/renv", description[["RemoteSha"]], sep = "@") + else + paste("renv", description[["Version"]], sep = "@") + + # display both loaded version + sha if available + friendly <- renv_bootstrap_version_friendly( + version = description[["Version"]], + sha = if (dev) description[["RemoteSha"]] + ) + + fmt <- heredoc(" + renv %1$s was loaded from project library, but this project is configured to use renv %2$s. + - Use `renv::record(\"%3$s\")` to record renv %1$s in the lockfile. + - Use `renv::restore(packages = \"renv\")` to install renv %2$s into the project library. + ") + catf(fmt, friendly, renv_bootstrap_version_friendly(version), remote) + + FALSE + + } + + renv_bootstrap_validate_version_dev <- function(version, description) { + expected <- description[["RemoteSha"]] + is.character(expected) && startswith(expected, version) + } + + renv_bootstrap_validate_version_release <- function(version, description) { + expected <- description[["Version"]] + is.character(expected) && identical(expected, version) + } + + renv_bootstrap_hash_text <- function(text) { + + hashfile <- tempfile("renv-hash-") + on.exit(unlink(hashfile), add = TRUE) + + writeLines(text, con = hashfile) + tools::md5sum(hashfile) + + } + + renv_bootstrap_load <- function(project, libpath, version) { + + # try to load renv from the project library + if (!requireNamespace("renv", lib.loc = libpath, quietly = TRUE)) + return(FALSE) + + # warn if the version of renv loaded does not match + renv_bootstrap_validate_version(version) + + # execute renv load hooks, if any + hooks <- getHook("renv::autoload") + for (hook in hooks) + if (is.function(hook)) + tryCatch(hook(), error = warnify) + + # load the project + renv::load(project) + + TRUE + + } + + renv_bootstrap_profile_load <- function(project) { + + # if RENV_PROFILE is already set, just use that + profile <- Sys.getenv("RENV_PROFILE", unset = NA) + if (!is.na(profile) && nzchar(profile)) + return(profile) + + # check for a profile file (nothing to do if it doesn't exist) + path <- renv_bootstrap_paths_renv("profile", profile = FALSE, project = project) + if (!file.exists(path)) + return(NULL) + + # read the profile, and set it if it exists + contents <- readLines(path, warn = FALSE) + if (length(contents) == 0L) + return(NULL) + + # set RENV_PROFILE + profile <- contents[[1L]] + if (!profile %in% c("", "default")) + Sys.setenv(RENV_PROFILE = profile) + + profile + + } + + renv_bootstrap_profile_prefix <- function() { + profile <- renv_bootstrap_profile_get() + if (!is.null(profile)) + return(file.path("profiles", profile, "renv")) + } + + renv_bootstrap_profile_get <- function() { + profile <- Sys.getenv("RENV_PROFILE", unset = "") + renv_bootstrap_profile_normalize(profile) + } + + renv_bootstrap_profile_set <- function(profile) { + profile <- renv_bootstrap_profile_normalize(profile) + if (is.null(profile)) + Sys.unsetenv("RENV_PROFILE") + else + Sys.setenv(RENV_PROFILE = profile) + } + + renv_bootstrap_profile_normalize <- function(profile) { + + if (is.null(profile) || profile %in% c("", "default")) + return(NULL) + + profile + + } + + renv_bootstrap_path_absolute <- function(path) { + + substr(path, 1L, 1L) %in% c("~", "/", "\\") || ( + substr(path, 1L, 1L) %in% c(letters, LETTERS) && + substr(path, 2L, 3L) %in% c(":/", ":\\") + ) + + } + + renv_bootstrap_paths_renv <- function(..., profile = TRUE, project = NULL) { + renv <- Sys.getenv("RENV_PATHS_RENV", unset = "renv") + root <- if (renv_bootstrap_path_absolute(renv)) NULL else project + prefix <- if (profile) renv_bootstrap_profile_prefix() + components <- c(root, renv, prefix, ...) + paste(components, collapse = "/") + } + + renv_bootstrap_project_type <- function(path) { + + descpath <- file.path(path, "DESCRIPTION") + if (!file.exists(descpath)) + return("unknown") + + desc <- tryCatch( + read.dcf(descpath, all = TRUE), + error = identity + ) + + if (inherits(desc, "error")) + return("unknown") + + type <- desc$Type + if (!is.null(type)) + return(tolower(type)) + + package <- desc$Package + if (!is.null(package)) + return("package") + + "unknown" + + } + + renv_bootstrap_user_dir <- function() { + dir <- renv_bootstrap_user_dir_impl() + path.expand(chartr("\\", "/", dir)) + } + + renv_bootstrap_user_dir_impl <- function() { + + # use local override if set + override <- getOption("renv.userdir.override") + if (!is.null(override)) + return(override) + + # use R_user_dir if available + tools <- asNamespace("tools") + if (is.function(tools$R_user_dir)) + return(tools$R_user_dir("renv", "cache")) + + # try using our own backfill for older versions of R + envvars <- c("R_USER_CACHE_DIR", "XDG_CACHE_HOME") + for (envvar in envvars) { + root <- Sys.getenv(envvar, unset = NA) + if (!is.na(root)) + return(file.path(root, "R/renv")) + } + + # use platform-specific default fallbacks + if (Sys.info()[["sysname"]] == "Windows") + file.path(Sys.getenv("LOCALAPPDATA"), "R/cache/R/renv") + else if (Sys.info()[["sysname"]] == "Darwin") + "~/Library/Caches/org.R-project.R/R/renv" + else + "~/.cache/R/renv" + + } + + renv_bootstrap_version_friendly <- function(version, shafmt = NULL, sha = NULL) { + sha <- sha %||% attr(version, "sha", exact = TRUE) + parts <- c(version, sprintf(shafmt %||% " [sha: %s]", substring(sha, 1L, 7L))) + paste(parts, collapse = "") + } + + renv_bootstrap_exec <- function(project, libpath, version) { + if (!renv_bootstrap_load(project, libpath, version)) + renv_bootstrap_run(version, libpath) + } + + renv_bootstrap_run <- function(version, libpath) { + + # perform bootstrap + bootstrap(version, libpath) + + # exit early if we're just testing bootstrap + if (!is.na(Sys.getenv("RENV_BOOTSTRAP_INSTALL_ONLY", unset = NA))) + return(TRUE) + + # try again to load + if (requireNamespace("renv", lib.loc = libpath, quietly = TRUE)) { + return(renv::load(project = getwd())) + } + + # failed to download or load renv; warn the user + msg <- c( + "Failed to find an renv installation: the project will not be loaded.", + "Use `renv::activate()` to re-initialize the project." + ) + + warning(paste(msg, collapse = "\n"), call. = FALSE) + + } + + renv_json_read <- function(file = NULL, text = NULL) { + + jlerr <- NULL + + # if jsonlite is loaded, use that instead + if ("jsonlite" %in% loadedNamespaces()) { + + json <- tryCatch(renv_json_read_jsonlite(file, text), error = identity) + if (!inherits(json, "error")) + return(json) + + jlerr <- json + + } + + # otherwise, fall back to the default JSON reader + json <- tryCatch(renv_json_read_default(file, text), error = identity) + if (!inherits(json, "error")) + return(json) + + # report an error + if (!is.null(jlerr)) + stop(jlerr) + else + stop(json) + + } + + renv_json_read_jsonlite <- function(file = NULL, text = NULL) { + text <- paste(text %||% readLines(file, warn = FALSE), collapse = "\n") + jsonlite::fromJSON(txt = text, simplifyVector = FALSE) + } + + renv_json_read_default <- function(file = NULL, text = NULL) { + + # find strings in the JSON + text <- paste(text %||% readLines(file, warn = FALSE), collapse = "\n") + pattern <- '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' + locs <- gregexpr(pattern, text, perl = TRUE)[[1]] + + # if any are found, replace them with placeholders + replaced <- text + strings <- character() + replacements <- character() + + if (!identical(c(locs), -1L)) { + + # get the string values + starts <- locs + ends <- locs + attr(locs, "match.length") - 1L + strings <- substring(text, starts, ends) + + # only keep those requiring escaping + strings <- grep("[[\\]{}:]", strings, perl = TRUE, value = TRUE) + + # compute replacements + replacements <- sprintf('"\032%i\032"', seq_along(strings)) + + # replace the strings + mapply(function(string, replacement) { + replaced <<- sub(string, replacement, replaced, fixed = TRUE) + }, strings, replacements) + + } + + # transform the JSON into something the R parser understands + transformed <- replaced + transformed <- gsub("{}", "`names<-`(list(), character())", transformed, fixed = TRUE) + transformed <- gsub("[[{]", "list(", transformed, perl = TRUE) + transformed <- gsub("[]}]", ")", transformed, perl = TRUE) + transformed <- gsub(":", "=", transformed, fixed = TRUE) + text <- paste(transformed, collapse = "\n") + + # parse it + json <- parse(text = text, keep.source = FALSE, srcfile = NULL)[[1L]] + + # construct map between source strings, replaced strings + map <- as.character(parse(text = strings)) + names(map) <- as.character(parse(text = replacements)) + + # convert to list + map <- as.list(map) + + # remap strings in object + remapped <- renv_json_read_remap(json, map) + + # evaluate + eval(remapped, envir = baseenv()) + + } + + renv_json_read_remap <- function(json, map) { + + # fix names + if (!is.null(names(json))) { + lhs <- match(names(json), names(map), nomatch = 0L) + rhs <- match(names(map), names(json), nomatch = 0L) + names(json)[rhs] <- map[lhs] + } + + # fix values + if (is.character(json)) + return(map[[json]] %||% json) + + # handle true, false, null + if (is.name(json)) { + text <- as.character(json) + if (text == "true") + return(TRUE) + else if (text == "false") + return(FALSE) + else if (text == "null") + return(NULL) + } + + # recurse + if (is.recursive(json)) { + for (i in seq_along(json)) { + json[i] <- list(renv_json_read_remap(json[[i]], map)) + } + } + + json + + } + + # load the renv profile, if any + renv_bootstrap_profile_load(project) + + # construct path to library root + root <- renv_bootstrap_library_root(project) + + # construct library prefix for platform + prefix <- renv_bootstrap_platform_prefix() + + # construct full libpath + libpath <- file.path(root, prefix) + + # run bootstrap code + renv_bootstrap_exec(project, libpath, version) + + invisible() + +}) diff --git a/tmd/areas/targets/prepare/renv/settings.json b/tmd/areas/targets/prepare/renv/settings.json new file mode 100644 index 00000000..ffdbb320 --- /dev/null +++ b/tmd/areas/targets/prepare/renv/settings.json @@ -0,0 +1,19 @@ +{ + "bioconductor.version": null, + "external.libraries": [], + "ignored.packages": [], + "package.dependency.fields": [ + "Imports", + "Depends", + "LinkingTo" + ], + "ppm.enabled": null, + "ppm.ignored.urls": [], + "r.version": null, + "snapshot.type": "implicit", + "use.cache": true, + "vcs.ignore.cellar": true, + "vcs.ignore.library": true, + "vcs.ignore.local": true, + "vcs.manage.ignores": true +} diff --git a/tmd/areas/targets/prepare/tools/renv_notes.R b/tmd/areas/targets/prepare/tools/renv_notes.R new file mode 100644 index 00000000..f61cb06e --- /dev/null +++ b/tmd/areas/targets/prepare/tools/renv_notes.R @@ -0,0 +1,14 @@ + +# https://docs.posit.co/ide/user/ide/guide/environments/r/renv.html + +# workflow: + +# renv::init() to initialize a new project-local environment with a private R library + +# Work in the project as normal, installing and removing new R packages as they are needed in the project, + +# renv::snapshot() to save the state of the project library to the lockfile (called renv.lock), + +# Continue working on your project, installing and updating R packages as needed. + +# renv::snapshot() again to save the state of your project library if your attempts to update R packages were successful, or call renv::restore() to revert to the previous state as encoded in the lockfile if your attempts to update packages introduced some new problems. \ No newline at end of file From 629234f04752fc348e50a1ff15debaa0fb1b3028 Mon Sep 17 00:00:00 2001 From: donboyd5 Date: Thu, 31 Oct 2024 07:40:30 -0400 Subject: [PATCH 23/24] add documentation for renv, R's variant on the concept of a package manager --- tmd/areas/targets/prepare/usage.qmd | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/tmd/areas/targets/prepare/usage.qmd b/tmd/areas/targets/prepare/usage.qmd index 2d6478af..00c99b2e 100644 --- a/tmd/areas/targets/prepare/usage.qmd +++ b/tmd/areas/targets/prepare/usage.qmd @@ -6,22 +6,18 @@ editor_options: # Usage: How to create Congressional District target files and the associated local web page -To Come: Use of `renv` to define versions of packages. - ## Prerequisites - Recent version of [R](https://www.r-project.org/). This project was created with R version 4.4.1. -- Recent versions of R packages used by this project. See ".../targets/prepare/R/libraries.R" +- Recent release of [RStudio](https://posit.co/products/open-source/rstudio/). Other IDEs may work well, but RStudio has been used in this project (RStudio 2024.09.0 Build 375). - Recent pre-release version of [quarto](https://quarto.org/docs/download/prerelease.html), 1.6 or higher. This project was created with quarto version 1.6.24 -- Be sure that ".../targets/prepare/cds/raw_data/" exists and has the files shown in the screenshot below. The GitHub repo includes these files: - - - - - - - -![](images/raw_data.jpeg) +- Be sure that ".../targets/prepare/cds/raw_data/" exists and has the files shown below. The GitHub repo includes these files: + - 21incddocguide.docx + - cd_documentation_extracted_from_21incddocguide.docx.xlsx + - cdpop1year_acs.csv + - congressional2021.zip + - geocorr2022_2428906586.csv +- After checking the above and starting RStudio, in the console run `renv::restore()`. `renv` is, in essence, a package manager for R designed to set up a private environment that is the same across multile machines. It should ensure that your environment includes appropriate versions of R packages used in this project (generally loaded in ".../targets/prepare/R/libraries.R"). ## To create target files and build the web page From beca8124a37f4258666ada3fc302bd082cae242d Mon Sep 17 00:00:00 2001 From: donboyd5 Date: Thu, 31 Oct 2024 07:40:50 -0400 Subject: [PATCH 24/24] improve basefile documentation --- .../prepare/cd_create_basefile_for_cd_target_files.qmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tmd/areas/targets/prepare/cd_create_basefile_for_cd_target_files.qmd b/tmd/areas/targets/prepare/cd_create_basefile_for_cd_target_files.qmd index ced4c05b..923bb220 100644 --- a/tmd/areas/targets/prepare/cd_create_basefile_for_cd_target_files.qmd +++ b/tmd/areas/targets/prepare/cd_create_basefile_for_cd_target_files.qmd @@ -4,9 +4,9 @@ editor_options: chunk_output_type: console --- -# Create base file for final CD target files +# Create base file for 117th Congressional District target files -This section creates one long file that is a superset of what we need for individual CD target files. This long file has everything needed to extract and save a target file for any CD. It also has additional convenience variables that will not be included in individual CD target files such as variable descriptions, human-friendly AGI-range labels, state fips codes, and a sort code for ordering records within a CD. +This section creates one long file that is a superset of what we need for individual 117th Congressional District target files. This long file has everything needed to extract and save a target file for any CD . It also has additional convenience variables that will not be included in individual CD target files such as variable descriptions, human-friendly AGI-range labels, state fips codes, and a sort code for ordering records within a CD. These variables are excluded when target files are written. ## Documentation for target files for individual CDs