query_resource_all: Function to streamline searching for resource records without...

View source: R/query_resource_all.R

query_resource_allR Documentation

Function to streamline searching for resource records without limiting to records associated with another specific resource. Eg, query ALL projects, not just those associated with the University of Exeter.

Description

Sends a query to return all records for your chosen resource. Note that the API returns a maximum of 100 results at a time and this you may need to specify a page or search to get the specific results you want.

Usage

query_resource_all(
  resource,
  size = 20,
  page_num = 1,
  search_term,
  search_fields,
  df_only = T
)

Arguments

resource

The name of the resource you would liek to query, as per gtr_endpoints.

size

The number of results you would like to return (max 100).

page_num

The page number of results you would like to see.

search_term

Term you want to check against search_fields. Search works on a 'contains' basis.

search_fields

Fields you want to check search_term against. Enter as character vector. Note fields must be referred to by their code, and some fields may be searched by default. Use get_configs() for details of codes and default search fields.

df_only

Choose whether you only want a dataframe of the 'core' results (T) or you would like additional metadata returned with the query (F).

Value

A dataframe holding the results for your chosen query, or a list holding the dataframe plus corresponding metadata..


shanej90/gtR documentation built on March 20, 2022, 5:19 p.m.