Skip to contents

Phase 3DDD4. Convenience wrapper over morie_dataset_portal_catalog() that lets callers filter + search by keyword, portal, api_mode, or loader pattern without writing subset expressions by hand.

Usage

morie_datasets_browse(
  keyword = NULL,
  portal = NULL,
  api_mode = NULL,
  loader_pattern = NULL,
  keyword_includes_url = FALSE,
  sort_by = c("dataset_key", "source", "n_rows_bundled", "id")
)

Arguments

keyword

Optional case-insensitive substring to grep against dataset_key/id/loader. NULL (default) skips this filter.

portal

Optional portal name (see morie_dataset_portal_catalog() for the canonical list). Accepts a character vector for multi-portal queries.

api_mode

Optional API mode substring to match against the api_modes column (e.g., "soda3", "arcgis", "opendatasoft", "statcan_wds", "manual_download"). Accepts a character vector.

loader_pattern

Optional perl-style regex against the loader column (e.g., "^morie_datasets_tps").

keyword_includes_url

If TRUE, also greps the dict_url.

sort_by

Sort order: "dataset_key" (default), "source", "n_rows_bundled" (descending), or "id".

Value

A data.frame – the filtered subset of the catalog with the same 7-column schema.

Details

Filters compose with AND semantics. A keyword matches against dataset_key + id + loader (case-insensitive). To match anywhere including the dict URL, pass keyword_includes_url = TRUE.

Examples

# All TPS datasets, alphabetical (offline; reads the cached
# cross-portal catalog -- no network).
tps <- morie_datasets_browse(portal = "tps_arcgis_hub")
nrow(tps)
#> [1] 71

# Anything mentioning "homicide"
h <- morie_datasets_browse(keyword = "homicide")
head(h$dataset_key)
#> [1] "homicides"                                
#> [2] "police-annual-statistical-report-homicide"