瀏覽代碼

move data collection into subfolder

main
Garrick Aden-Buie 3 年之前
父節點
當前提交
70369dd98b
沒有發現已知的金鑰在資料庫的簽署中
共有 13 個檔案被更改,包括 13 行新增 和 10 行删除
  1. +3
    -2
      .gitignore
  2. +4
    -4
      collect/DESCRIPTION
  3. +0
    -0
      collect/R/get.R
  4. +6
    -4
      collect/R/read_report_file.R
  5. +0
    -0
      collect/R/urls.R
  6. +0
    -0
      collect/R/utils-delay.R
  7. +0
    -0
      collect/README.Rmd
  8. +0
    -0
      collect/_targets.R
  9. +0
    -0
      collect/_targets/.gitignore
  10. +0
    -0
      collect/_targets/meta/meta
  11. +0
    -0
      collect/nc-campaign-finance_collect.Rproj
  12. +0
    -0
      collect/run.R
  13. +0
    -0
      collect/scripts/2023-09-24_organize-data-raw-into-subfolders.R

+ 3
- 2
.gitignore 查看文件

@@ -4,5 +4,6 @@
.Rdata
.history
0-time-log.csv
data-raw/
data/
data-raw
collect/data-raw/
collect/data-old/

DESCRIPTION → collect/DESCRIPTION 查看文件

@@ -1,12 +1,12 @@
Type: Project
Package: nc-campaign-finance
Title: What the Package Does (One Line, Title Case)
Package: nc-campaign-finance-collect
Title: Collect NC Campaign Finance Data
Version: 0.0.0.9000
Authors@R:
person("Garrick", "Aden-Buie", , "garrick@adenbuie.com", role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-7111-0077"))
Description: What the package does (one paragraph).
License: MIT + file LICENSE
Description: Collect campaign finance data from the NC State Board of Elections.
License: None
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3

R/get.R → collect/R/get.R 查看文件


R/read_report_file.R → collect/R/read_report_file.R 查看文件

@@ -52,13 +52,12 @@ read_report_section <- function(section, info, report_path) {

read_reports_by_sboe_id <- function(sboe_id) {
raw_paths <- fs::dir_ls(
here::here("data-raw", "reports", sboe_id),
here::here("data-raw", "reports", sboe_id, "all"),
glob = "*.txt"
)
names(raw_paths) <- fs::path_rel(raw_paths, here::here("data-raw", "reports"))

data <-
raw_paths |>
raw_paths |>
map(read_report_file) |>
transpose() |>
map(list_rbind) |>
@@ -101,11 +100,14 @@ write_reports_by_sboe_id <- function(sboe_id) {
}

report_path_info <- function(report_path) {
# data-raw/reports/{sboe_id}/all/{report_id}_{received_date}.txt
report_path <- fs::path_abs(report_path)
x <- fs::path_rel(report_path, here::here("data-raw", "reports"))
x <- fs::path_split(x)[[1]]

id <- strsplit(x[2], "_")[[1]][1]
# x[2] is "all"

id <- strsplit(x[3], "_")[[1]][1]

list(
sboe_id = x[1],

R/urls.R → collect/R/urls.R 查看文件


R/utils-delay.R → collect/R/utils-delay.R 查看文件


README.Rmd → collect/README.Rmd 查看文件


_targets.R → collect/_targets.R 查看文件


_targets/.gitignore → collect/_targets/.gitignore 查看文件


_targets/meta/meta → collect/_targets/meta/meta 查看文件


nc-campaign-finance.Rproj → collect/nc-campaign-finance_collect.Rproj 查看文件


run.R → collect/run.R 查看文件


scripts/2023-09-24_organize-data-raw-into-subfolders.R → collect/scripts/2023-09-24_organize-data-raw-into-subfolders.R 查看文件


Loading…
取消
儲存