Skip to content

Commit

Permalink
Improve default description for extracts
Browse files Browse the repository at this point in the history
  • Loading branch information
elipousson committed May 29, 2024
1 parent efaf66c commit d9e7067
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion R/get_nhgis_ts_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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()`,
Expand Down

0 comments on commit d9e7067

Please sign in to comment.