Retrieves a live catalog of San Franciso Open Data datasets from the San Franciso Open Data Portal catalog table (`CATALOG_DATASET_ID`) and returns dataset metadata that can be used with [sf_pull_dataset()()].
Value
A tibble containing available San Franciso Open Data datasets. Important columns include:
- key
A human-readable dataset key generated from the dataset name.
- dataset_id
The official Socrata dataset identifier used by San Franciso Open Data.
- dataset_name
The dataset name from the San Franciso Open Data catalog.
Additional metadata columns from the San Francisco Open Data catalog may also be returned.
Details
The returned tibble includes both the official Socrata dataset `ID` and a human-readable `key`. The `ID` is the stable identifier used by the San Franciso Open Data Portal and Socrata API, while the `key` is generated from the dataset name using [janitor::make_clean_names()] to make datasets easier to reference in R code, especially in classroom and reproducible research settings.
Most users will begin by calling `sf_list_datasets()`, searching the returned catalog for a dataset of interest, and then passing either the `key` or `ID` to [sf_pull_dataset()].
Examples
if (interactive() && curl::has_internet()) {
catalog <- sf_list_datasets()
# View available datasets
catalog
# Search for datasets containing a keyword
catalog[
grepl("Health", catalog$dataset_name, ignore.case = TRUE),
c("key", "dataset_id", "dataset_name")
]
}