Skip to contents

Search and download datasets that BPS distributes in spreadsheets. The API calls them static tables.

  • bps_dataset_spreadsheet() requests the spreadsheet dataset table

  • bps_download_spreadsheet() downloads a spreadsheet

Usage

bps_dataset_spreadsheet(
  keyword = NULL,
  month = NULL,
  year = NULL,
  domain_id = "0000",
  page = NULL,
  lang = c("ind", "eng")
)

bps_download_spreadsheet(
  dataset_id,
  file_path,
  domain_id = "0000",
  lang = c("ind", "eng")
)

Arguments

keyword

The keyword to filter the search result.

month

The month in which a spreadsheet is last updated.

year

The year in which a spreadsheet is last updated.

domain_id

The domain ID of a BPS bureau. Defaults to "0000", which is the domain ID of the central bureau. Use bps_domain() to see the list of domain IDs.

page

The page number of the result. Defaults to page one. Set to Inf to request all pages.

lang

The result's language. Must be either "ind" for Indonesian or "eng" for English. Defaults to Indonesian.

dataset_id

The dataset ID. Use bps_dataset_spreadsheet() to see the list of dataset IDs.

file_path

The path to save the spreadsheet. Must have a ".xls" extension.

Value

  • bps_dataset_spreadsheet() returns a tibble containing dataset IDs and titles, as well as other related details.

  • bps_download_spreadsheet() invisibly returns a string of the file path.

File format

The spreadsheet dataset comes in a Microsoft Excel file format with the ".xls" extension.

See also

bps_download() to download resources by URL.

Examples

# Search spreadsheet datasets on unemployment
spreadsheet <- bps_dataset_spreadsheet(
  keyword = "unemployment",
  lang = "eng"
)

if (FALSE) {
bps_download_spreadsheet(spreadsheet$dataset_id[[1]], "spreadsheet.xls")
}