Searches for artworks in museum collections based on a query string and returns artwork data for matching items.
Arguments
- query
A character string containing the search query. Cannot be NULL. Spaces will automatically be converted to hyphens.
- museum
A character string indicating the museum to query. Currently supports:
"artic" - Art Institute of Chicago
"met" - Metropolitan Museum of Art
- fields
An optional vector of field names (character) to return for each artwork. If NULL (default), returns all available fields.
- size
The maximum number of results to return. Defaults to 10.
Value
A tibble (data frame) where each row represents one artwork matching the search criteria and columns contain the requested fields.
References
Art Institute of Chicago API: https://api.artic.edu/docs/ Metropolitan Museum of Art API: https://metmuseum.github.io/
Examples
if (FALSE) { # \dontrun{
# Search for artworks related to "sunflowers" in Art Institute of Chicago
search_artworks("sunflowers", museum = "artic")
# Search Met Museum with specific fields to return
search_artworks("monet", museum = "met", fields = c("title", "artistDisplayName", "objectDate"))
# Search with a larger result set
search_artworks("landscape", museum = "artic", size = 25)
} # }