Skip to contents

Provides access to the Socrata Discovery API, allowing you to search tens of thousands of government datasets and assets published on the Socrata platform. Governments at all levels publish data on topics including crime, permits, finance, healthcare, research, and performance.

Usage

soc_discover(
  attribution = NULL,
  categories = NULL,
  domains = NULL,
  ids = NULL,
  names = NULL,
  only = "dataset",
  provenance = NULL,
  query = NULL,
  tags = NULL,
  location = "us",
  chunk_size = 10000
)

Arguments

attribution

string; Filter by the attribution or publisher

categories

character vector; Filter by categories.

domains

character vector; Filter to domains.

ids

character vector; Filter by specific asset IDs.

names

character vector; Filter by asset names.

only

character vector; Filter to specific asset types. Must be one or more of: "chart", "dataset", "filter", "link", "map", "measure", "story", "system_dataset", "visualization". Default is "dataset".

provenance

character vector; Filter by provenance. Must be one or more of: "official" or "community".

query

character string; Filter using a a token matching one from an asset's name, description, category, tags, column names, column fieldnames, column descriptions or attribution.

tags

character vector; Filter by tags associated with the assets.

location

string; Regional API domain: "us" (default) or "eu".

chunk_size

whole number; Number of results per request; used for pagination. Default is 10,000.

Value

A tibble containing metadata for each discovered asset. Columns include:

id

Asset identifier (four-by-four ID).

name

Asset name.

attribution

Attribution or publisher of the asset.

owner_name

Display name of the asset owner.

provenance

Provenance of asset (official or community).

description

Textual description of the asset.

created

Date asset was created.

data_last_updated

Date asset data was last updated

metadata_last_updated

Date asset metadata was last updated

categories

Category labels assigned to the asset.

tags

Tags associated with the asset.

domain_category

Category label assigned by the domain.

domain_tags

Tags applied by the domain.

domain_metadata

Metadata associated with the asset assigned by the domain.

column_names

Names of asset columns.

column_labels

Labels of asset columns.

column_datatypes

Datatypes of asset columns.

column_descriptions

Description of asset columns.

permalink

Permanent URL where the asset can be accessed.

link

Direct asset link.

license

License associated with the asset.

Examples

if (FALSE) { # \dontrun{
# Search for crime-related datasets in the Public Safety category
results <- soc_discover(
  query = "crime",
  categories = c("Public Safety"),
  only = "dataset"
)
} # }