Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

57 Zeilen
1.7KB

  1. # Created by use_targets().
  2. # Follow the comments below to fill in this target script.
  3. # Then follow the manual to check and run the pipeline:
  4. # https://books.ropensci.org/targets/walkthrough.html#inspect-the-pipeline
  5. # Load packages required to define the pipeline:
  6. library(targets)
  7. # Set target options:
  8. tar_option_set(
  9. packages = strsplit(desc::desc_get_field("Depends"), ", ")[[1]],
  10. # For distributed computing in tar_make(), supply a {crew} controller
  11. # as discussed at https://books.ropensci.org/targets/crew.html.
  12. controller = crew::crew_controller_local(workers = 2)
  13. )
  14. # Run the R scripts in the R/ folder with your custom functions:
  15. tar_source()
  16. # Replace the target list below with your own:
  17. list(
  18. tar_target(year, 2016:2023),
  19. tar_target(report, c("MY", "YE", "Q1", "Q2", "Q3", "Q4")),
  20. tar_target(
  21. doc_list,
  22. get_report_by_year_scrape(year, report),
  23. pattern = cross(year, report)
  24. ),
  25. tar_target(
  26. committees,
  27. doc_list |>
  28. # this is the list of committees and years reported
  29. # if `n_*` changes, we have to go re-read that year
  30. group_by(committee_name, sboe_id, year) |>
  31. summarize(
  32. n_reports = n(),
  33. n_amended = sum(amended),
  34. n_docs = sum(!is.na(report_id)),
  35. ) |>
  36. arrange(sboe_id)
  37. ),
  38. tar_target(
  39. report_list,
  40. doc_list |>
  41. filter(!is.na(report_id)) |>
  42. filter(committee_name == "JOHN BELL COMM" | report_id == 188139)
  43. ),
  44. tar_target(report_list_report_id, report_list$report_id),
  45. tar_target(report_list_sboe_id, report_list$sboe_id),
  46. tar_target(
  47. receipts,
  48. get_report_section(report_list_report_id, "receipts", report_list_sboe_id),
  49. pattern = map(report_list_report_id, report_list_sboe_id),
  50. format = "parquet"
  51. )
  52. )