JHU Data Science

Travis build status AppVeyor Build Status Coverage status

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-"
)

fedreporter Package:

The goal of fedreporter is to provide downloads data from NIH 'ExPORTER'

Installation

You can install fedreporter from GitHub with:

# install.packages("remotes")
remotes::install_github("muschellij2/fedreporter")

Example

Project Search for R01s from NIH

library(fedreporter)
res = fe_projects_search(
  project_number = "*R01*",
  fiscal_year = 2012,
  agency = "NIH",
  text = "stroke",
  text_field = "title")
names(res)
res$response
length(res$content)
names(res$content)
res$content$offset
length(res$content$items)

Project Search for Individual PIs

res = fe_projects_search(pi_name = "MATSUI, ELIZABETH")
items = res$content$items
con_pis = sapply(items, "[[", "contactPi")
keep = grepl("^MATSUI", con_pis)
items = items[keep]
mat_costs = sapply(items, "[[", "totalCostAmount")
sum(mat_costs)

res = fe_projects_search(pi_name = "PENG, ROGER")
items = res$content$items
con_pis = sapply(items, "[[", "contactPi")
keep = grepl("^PENG", con_pis)
items = items[keep]
peng_costs = sapply(items, "[[", "totalCostAmount")
sum(peng_costs)

# both = fe_projects_search(pi_name = c("MATSUI, ELIZABETH", "PENG, ROGER"))


muschellij2/fedreporter documentation built on May 7, 2019, 9:42 p.m.