core_search: Search CORE

View source: R/core_search.R

core_repos_search_R Documentation

Search CORE

Description

Search CORE

Usage

core_repos_search_(query, page = 1, limit = 10, key = NULL, ...)

core_search(query, page = 1, limit = 10, key = NULL, parse = TRUE, ...)

core_search_(query, page = 1, limit = 10, key = NULL, ...)

Arguments

query

(character) query string, required

page

(character) page number (default: 1), optional

limit

(character) records to return (default: 10, minimum: 10, maximum: 100), optional

key

A CORE API key. Get one at https://core.ac.uk/api-keys/register. Once you have the key, you can pass it into this parameter, or as a much better option, store your key as an environment variable with the name CORE_KEY or an R option as core_key. See ?Startup for how to work with env vars and R options

...

Curl options passed to HttpClient

parse

(logical) Whether to parse to list (FALSE) or data.frame (TRUE). Default: TRUE

Details

core_search does the HTTP request and parses, while core_search_ just does the HTTP request, gives back JSON as a character string

References

https://core.ac.uk/docs/#!/all/search

Examples

## Not run: 
core_search(query = 'ecology')
core_search(query = 'ecology', parse = FALSE)
core_search(query = 'ecology', limit = 12)

core_search_(query = 'ecology')
library("jsonlite")
jsonlite::fromJSON(core_search_(query = 'ecology'))

# post request
query <- c('data mining', 'machine learning', 'semantic web')
res <- core_search(query)
res
res$status
res$totalHits
res$data
head(res$data[[1]])

## End(Not run)

ropensci/rcore documentation built on Sept. 16, 2022, 5:36 p.m.