Downloads data from a specific SITUAS report. Supports both DATA type reports (single date) and PERIODO type reports (date range).

situas_get_report_data(pfun, date = Sys.Date(), date_end = NULL)

Arguments

pfun

Integer. Report ID (function number). See list_available_reports for a list of valid report IDs.

date

Date, POSIXct, or character string. The reference date for the report. For DATA type reports, this is the single date parameter. For PERIODO type reports, this is the start date. Defaults to current date.

date_end

Date, POSIXct, or character string. End date for PERIODO type reports. Leave NULL for DATA type reports. Defaults to NULL.

Value

A data.table containing the report data

Examples

if (FALSE) { # \dontrun{
# Get current municipalities list (DATA type report)
municipalities <- situas_get_report_data(pfun = 61)

# Get municipalities as of a specific date
municipalities_2020 <- situas_get_report_data(
  pfun = 61,
  date = as.Date("2020-01-01")
)

# Get municipality changes over a period (PERIODO type report)
changes <- situas_get_report_data(
  pfun = 99,
  date = as.Date("2020-01-01"),
  date_end = as.Date("2025-01-01")
)
} # }