dpla_search: Search metadata from the Digital Public Library of America...

View source: R/dpla_search.r

dpla_searchR Documentation

Search metadata from the Digital Public Library of America (DPLA).

Description

Search metadata from the Digital Public Library of America (DPLA).

Usage

dpla_search(q = NULL, verbose = FALSE, fields = NULL, limit = 10,
  page = NULL, sort_by = NULL, date.before = NULL, date.after = NULL,
  callopts = list())

Arguments

q

Query terms.

verbose

If TRUE, fun little messages print to console to inform you of things.

fields

A vector of the fields to return in the output. The default is all fields. See details for options.

limit

Number of items to return, defaults to 10. Max of 100.

page

Page number to return, defaults to NULL.

sort_by

The default sort order is ascending. Most, but not all fields can be sorted on. Attempts to sort on an un-sortable field will return the standard error structure with a HTTP 400 status code.

date.before

Date before

date.after

Date after

callopts

Curl options passed on to httr::GET

Details

Options for the fields argument are:

  • sourceResource.title The title of the object

  • sourceResource.decription The description of the object

  • sourceResource.subject The subjects of the object

  • sourceResource.creator The creator of the object

  • sourceResource.type The type of the object

  • sourceResource.publisher The publisher of the object

  • sourceResource.format The format of the object

  • sourceResource.rights The rights for the object

  • sourceResource.contributor The contributor of the object

  • sourceResource.spatial The spatial of the object

  • isPartOf The isPartOf thing, not sure what this is

  • provider The provider of the object

  • id The item id

Value

A data.frame of results.

Examples

## Not run: 
# Basic search, "fruit" in any fields
dpla_search(q="fruit")

# Some verbosity
dpla_search(q="fruit", verbose=TRUE, limit=2)

# Return certain fields
dpla_search(q="fruit", verbose=TRUE, fields=c("publisher","format"))
dpla_search(q="fruit", fields="subject")

# Max is 100 per call, but the function handles larger numbers by looping
dpla_search(q="fruit", fields="id", limit=200)
dpla_search(q="fruit", fields=c("id","provider"), limit=200)
dpla_search(q="fruit", fields=c("id","provider"), limit=200)
out <- dpla_search(q="science", fields=c("id","subject"), limit=400)
head(out)

# Search by date
dpla_search(q="science", date.before=1900, limit=200)

# Spatial search
dpla_search(q='Boston', fields='spatial')

## End(Not run)

ropensci/rmetadata documentation built on May 18, 2022, 6:41 p.m.