Skip to contents

Convenience wrapper over morie_ingest_ckan_package_search that flattens the most-useful columns into a single data.frame: id, name, title, organization, license_id, metadata_modified, num_resources, url (the canonical <portal>/dataset/<name> URL).

Usage

morie_ingest_ckan_search_packages(
  portal,
  query,
  rows = 50L,
  api_key = NULL,
  user_agent = .MORIE_CKAN_DEFAULT_UA,
  timeout = .MORIE_CKAN_DEFAULT_TIMEOUT
)

Arguments

portal

Base URL of the CKAN portal.

query

Free-text query string.

rows

Maximum rows to return (default 50).

api_key

Optional CKAN API key.

user_agent

User-Agent header sent with the request.

timeout

HTTP timeout in seconds.

Value

A base R data.frame.

Examples

try(morie_ingest_ckan_search_packages("https://open.canada.ca/data", query = "crime", rows = 1L))
#>                                     id                                 name
#> 1 b068d330-4d34-49dc-8efb-017dfb45edcf b068d330-4d34-49dc-8efb-017dfb45edcf
#>                        title                           organization license_id
#> 1 Crimes, by actual offences Statistics Canada | Statistique Canada ca-ogl-lgo
#>            metadata_modified num_resources
#> 1 2023-01-17T21:25:32.803471             5
#>                                                                        url
#> 1 https://open.canada.ca/data/dataset/b068d330-4d34-49dc-8efb-017dfb45edcf