Note that it can only return a maximum of 9976 grants per call.

nsf_return(
  keyword = NULL,
  zipcode = NULL,
  agency = "NSF",
  statecode = NULL,
  startdate = NULL,
  enddate = NULL,
  verbose = TRUE,
  print_fields = print_fields_get(),
  save_file = NULL
)

Arguments

keyword

Optional keyword to search on

zipcode

Optional zip code to limit search to (note that you should try both 5 and 9 digit). Note that there are often grants that lack zip code info

agency

Agency to search for (NSF or NASA)

statecode

Two letter state code for the awardee location

startdate

Start date for award date to search. Accepted date format is mm/dd/yyyy (ex.12/31/2012)

enddate

End date for award date to search. Accepted date format is mm/dd/yyyy (ex.12/31/2012)

verbose

If TRUE, outputs progress

print_fields

Names of elements to return (see NSF API documentation)

save_file

File to save results to while running

Value

A data frame with returned info

Examples

ants <- nsf_return(keyword="Formicidae")
#> [1] "Finished first batch"
nsf_wordcloud(ants$abstractText)


sanderson <- nsf_return(keyword="Sanderson")
#> [1] "Finished first batch"
#> 
Finished next batch of 25 records; now 50 records from 2000 to 2014
Finished next batch of 25 records; now 75 records from 1992 to 2014
Finished next batch of 11 records; now 86 records from 1970 to 2014
mjs.PI <- sanderson[grepl("Michael J Sanderson",sanderson$pdPIName),] #note the lack of period for middle initial in the search string
mjs.CoPI <- sanderson[grepl("Michael J Sanderson",sanderson$coPDPI),]
mjs.grants <- rbind(mjs.PI, mjs.CoPI)
plot(x=lubridate::mdy(mjs.grants$startDate), y=mjs.grants$fundsObligatedAmt, pch=20, log="y", bty="n", xlab="Start date", ylab="Funding amount in US dollars")