#' @title gtr_policy
#'
#' @description This function provides the policy influence items for a project
#' @param url project URL from gtr.ukri.org
#' @export
#' @return Dataframe with projects and policy outcome
gtr_policy<-function(url){
firmTEST<-httr::GET(url,httr::add_headers("Accept: application/vnd.rcuk.gtr.json-v7"))
firmTEXT<-httr::content(firmTEST, as="text")
JLfirm<-jsonlite::fromJSON(firmTEXT, flatten=TRUE)
ORG<-JLfirm$projectOverview$projectComposition
proj_id<-ORG$project$grantReference
imp<-ORG$project$output
pol_imp<-imp$policyInfluenceOutput
desc<-pol_imp$description
pol_type<-pol_imp$type
impact<-pol_imp$impact
geo<-pol_imp$geographicReach
LEN<-length(desc)
ref_rep<-rep(proj_id,LEN)
DATA<-tibble::tibble(project_id=ref_rep,
policy_influence_type=pol_type,
description=desc,
impact=impact,
geographic_region=geo)
return(DATA)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.