Skip to contents

Retrieves metadata attributes from a tibble returned by soc_read() or using the dataset url, including dataset-level information and column-level descriptions.

Usage

soc_metadata(dataset)

Arguments

dataset

A tibble returned by soc_read() or a url.

Value

An object of class soc_meta, which includes:

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

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.

columns

A dataframe with the following columns:

column_name

Names of asset columns.

column_label

Labels of asset columns.

column_datatype

Datatypes of asset columns.

column_description

Description of asset columns.

permalink

Permanent URL where the asset can be accessed.

link

Direct asset link.

license

License associated with the asset.

Details

This function pulls out descriptive metadata such as the dataset's ID, title, attribution, category, creation and update timestamps, description, any domain-specific fields, and field descriptions defined by the data provider.

Examples

# \donttest{
url <- "https://soda.demo.socrata.com/dataset/USGS-Earthquakes-2012-11-08/3wfw-mdbc/"
data <- soc_read(url, soc_query(limit = 1000L))
metadata <- soc_metadata(data)
print(metadata)
#> ID: 3wfw-mdbc
#> Name: USGS Earthquakes 2012-11-08
#> Attribution:
#> Owner: Chris Metcalf
#> Provenance: official
#> Description:
#> Created: 2012-11-08 19:44:56
#> Data last updated: 2013-06-06 19:16:18
#> Metadata last Updated: 2013-06-06 18:51:32
#> Domain Category:
#> Domain Tags:
#> Domain fields:
#> Columns:
#> # A tibble: 10 × 3
#>    column_name                 column_label       column_datatype
#>    <chr>                       <chr>              <chr>          
#>  1 source                      Source             text           
#>  2 earthquake_id               Earthquake ID      text           
#>  3 version                     Version            text           
#>  4 datetime                    Datetime           calendar_date  
#>  5 magnitude                   Magnitude          number         
#>  6 depth                       Depth              number         
#>  7 number_of_stations          Number of Stations number         
#>  8 region                      Region             text           
#>  9 location                    Location           location       
#> 10 :@computed_region_k83t_ady5 Zip Codes          number         
#> Permalink: https://soda.demo.socrata.com/d/3wfw-mdbc
#> Link:
#> https://soda.demo.socrata.com/dataset/USGS-Earthquakes-2012-11-08/3wfw-mdbc
#> License:

metadata <- soc_metadata(url)
print(metadata)
#> ID: 3wfw-mdbc
#> Name: USGS Earthquakes 2012-11-08
#> Attribution:
#> Owner: Chris Metcalf
#> Provenance: official
#> Description:
#> Created: 2012-11-08 19:44:56
#> Data last updated: 2013-06-06 19:16:18
#> Metadata last Updated: 2013-06-06 18:51:32
#> Domain Category:
#> Domain Tags:
#> Domain fields:
#> Columns:
#> # A tibble: 10 × 3
#>    column_name                 column_label       column_datatype
#>    <chr>                       <chr>              <chr>          
#>  1 source                      Source             text           
#>  2 earthquake_id               Earthquake ID      text           
#>  3 version                     Version            text           
#>  4 datetime                    Datetime           calendar_date  
#>  5 magnitude                   Magnitude          number         
#>  6 depth                       Depth              number         
#>  7 number_of_stations          Number of Stations number         
#>  8 region                      Region             text           
#>  9 location                    Location           location       
#> 10 :@computed_region_k83t_ady5 Zip Codes          number         
#> Permalink: https://soda.demo.socrata.com/d/3wfw-mdbc
#> Link:
#> https://soda.demo.socrata.com/dataset/USGS-Earthquakes-2012-11-08/3wfw-mdbc
#> License:
# }