Access outbreak.info Research Library API
getResourcesResponse(
queryString = NULL,
size = 10,
fetchAll = FALSE,
fields = NULL,
sort = NULL,
facets = NULL,
facet_size = 10,
queryStub = "https://api.outbreak.info/resources/query?"
)
(optional) number of records to return (default = 10)
(optional) Boolean whether to return all results for the query
(optional) vector specifying which fields to return. Returns all by default
(optional) field to sort by. Add `-` to sort in descending order
(optional) field by which to aggregate (count) their frequency
(optional) how many facet groups to include in the facet total (default = 10, max = 1000)
(optional) constructs a query over ALL fields, or a fielded query searching within specific fields. Fielded query terms should be separated by ` AND ` or ` OR `. See Elasticserach query strings for more info.
dataframe or list (for facetted queries) containing the response of the API query
# Return only the first 10 hits for "ivermectin"
df = getResourcesResponse("ivermectin", size = 10)
# Find the first 10 results which contain the variable `topicCategory`
df = getResourcesResponse("_exists_:topicCategory", size = 10)
# Get `date`/`name` from the first 10 hits for the query "ivermectin" plus a count of the `@type` field for ALL results
df = getResourcesResponse("ivermectin", size = 10, facets="@type", fields=c("date", "name"))