knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

Note this article relates to a legacy functions. Its capabilities are now covered by get_resources().

Introduction

The query_resource_all() function enables you to retrieve all records for a particular resource using a search term. If you want to limit the records returned to a specific institution, this requires additional arguments.

query_resource_combination() uses a list of defined combinations of resources (gtr_combinations) as well as an id argument to refine the records and only include those that match your resource combination and id.

Process

  1. First you will need to check gtr_combinations to identify what resource combinations are required. The first resource in these combinations is what we will be filtering against using the id argument, and the second resource are the records that will be returned (eg. the "organisation project" combination will return all projects for a specific organisation, where the organisation is determined by the id).

  2. Next you need to retrieve the id that will be used to filter the resource. This can be done by using the query_resource_all function and making note of the id of the relevant record.

  3. You can now use query_resource_combination function with the two resources found in gtr_combinations and the id retrieved from query_resource_all.

Example

You want to return all projects linked to the University of Exeter.

library(gtR)

exeter_id <- query_resource_all(
  resource = "organisation",
  search_term = "Exeter"
  )

id <- "961756BF-E31F-4A13-836F-0A09BA02385C"

data <- query_resource_combination(
  resource = "organisation",
  output = "project",
  "961756BF-E31F-4A13-836F-0A09BA02385C",
  size = 10
)

data


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