data_import_procedure.md

  1. Navigate to folder in data_raw
  2. Add code to read in CSV/similar to process_data_sets_*.R and give DATA_SET_NAME
  3. Clean data set if needed
  4. Open README.md if exists in folder
  5. Open Meta tab to Data to feed R pkg documentation Google Sheet and add DATA_SET_NAME to DATA_SET_NAME column
  6. Copy TITLE and LINK from README.md
  7. Get nrow(DATA_SET_NAME) and ncol(DATA_SET_NAME) and copy into NUM_ROWS and NUM_COLS columns
  8. Determine OBSUNIT and fill in column
  9. Find source in README.md or look over article linked at https://github.com/fivethirtyeight/data
  10. Add DATA_SET_NAME to DATA_SET_NAME column in Variables data tab of Data to feed R pkg documentation Google Sheet
  11. Run get_names <- function(x) {cat(names(x), sep = "\n")}; get_names(x) with x = DATA_SET_NAME
  12. Copy values into VARNAME column
  13. Copy md table from README.md into VAR_DESC_FULL
  14. VAR_DESC is automatically created using Excel formula: =IF(C2="","", TRIM(RIGHT(C2,LEN(C2)-FIND("|",C2) - 1)))
  15. Source data-raw/create_doc.R
  16. Run devtools::use_data(DATA_FRAME, overwrite = TRUE) code to create Rdata file in process_data_sets_*.R
  17. Build & Reload package using Command + Shift + B (on Mac)
  18. Also creates R documentation if settings checked


rudeboybert/fivethirtyeight documentation built on Jan. 1, 2023, 10:17 p.m.