From d9e7067a70db4fbb25206af3dfc7ac7d3a2e4e57 Mon Sep 17 00:00:00 2001 From: your name Date: Wed, 29 May 2024 13:03:53 -0400 Subject: [PATCH] Improve default description for extracts --- R/get_nhgis_ts_data.R | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/R/get_nhgis_ts_data.R b/R/get_nhgis_ts_data.R index 0f622e4..2d05e57 100644 --- a/R/get_nhgis_ts_data.R +++ b/R/get_nhgis_ts_data.R @@ -145,7 +145,10 @@ define_nhgis_ts_extract <- function(year = NULL, ) ipumsr::define_extract_nhgis( - description = description %||% "", + description = nhigs_description( + description = description, + time_series_tables + ), time_series_tables = time_series_tables, shapefiles = shapefiles, tst_layout = tst_layout, @@ -154,6 +157,20 @@ define_nhgis_ts_extract <- function(year = NULL, ) } +#' Helper function for creating a default NHGIS extract description +#' @noRd +nhigs_description <- function(description, + ts_tables = NULL) { + if (!is.null(ts_tables)) { + description %||% paste0( + "Extract created with {ipumseasyr} R package ", + "using the time series tables: ", paste0(ts_tables, collapse = ", "), "." + ) + } else { + description %||% "Extract created with the {ipumseasyr} R package." + } +} + #' Get NHGIS time series data #' #' Use `define_nhgis_ts_extract()`, `ipumsr::submit_extract()`,