Skip to contents

Unified interface for accessing all realestatebr datasets. Resolves data from the package's GitHub release assets when possible (fast, pre-processed, updated weekly by CI) and falls back to a fresh download from the original source. Repeated calls within one R session are served from an in-memory memo to avoid redundant network traffic.

Usage

get_dataset(
  name,
  table = NULL,
  source = "auto",
  date_start = NULL,
  date_end = NULL,
  quiet = FALSE,
  ...
)

Arguments

name

Character. Dataset name (see list_datasets for options). Each dataset has its own help topic documenting tables and columns: abecip, abrainc, bcb_realestate, bcb_series, fgv_ibre, paic, pnad_housing, pim_pf_construction, rppi, rppi_bis, secovi, and sinapi.

table

Character. Specific table within a multi-table dataset. See get_dataset_info for available tables per dataset.

source

Character. Data source preference:

"auto"

Use the in-session memo if available, otherwise GitHub releases, otherwise fresh download (default).

"github"

Pre-processed asset from the package's GitHub release.

"fresh"

Fresh download from the original source.

Use clear_session_cache to drop the in-session memo.

date_start

Date. Optional first date to retain for time-series datasets. Retained for compatibility; filtering is applied after the dataset is loaded.

date_end

Date. Optional last date to retain for time-series datasets. Retained for compatibility; filtering is applied after the dataset is loaded.

quiet

Logical. If TRUE, suppresses informational messages. Errors and warnings are still shown.

...

Additional arguments passed to the internal function when a fresh download is required. Retained for compatibility with the 1.0.1 interface.

Value

A tibble or named list, depending on the dataset. Use get_dataset_info to inspect the expected structure.

Details

To restrict a time series to a date window, use date_start and date_end or filter the returned date column with dplyr::filter().

See also

query_dataset() for large relational datasets, list_datasets for available datasets, get_dataset_info for dataset details, clear_session_cache to drop the in-session memo. For table and column documentation of each dataset, see the dataset help topics: abecip, abrainc, bcb_realestate, bcb_series, fgv_ibre, paic, pnad_housing, pim_pf_construction, rppi, rppi_bis, secovi, and sinapi.

Examples

if (FALSE) { # interactive()
abecip_data <- get_dataset("abecip")

sbpe_data <- get_dataset("abecip", table = "sbpe")

bcb_data <- get_dataset("bcb_series", quiet = TRUE)

bcb_recent <- get_dataset(
  "bcb_series",
  date_start = as.Date("2020-01-01")
)
}