write_nih_deadlines_excel: Write NIH Deadline Data to Excel

View source: R/nih_grant_scraper.R

write_nih_deadlines_excelR Documentation

Write NIH Deadline Data to Excel

Description

This function takes a character vector of NIH grant page URLs and an output file path, calls parse_nih_due_dates to extract key dates and metadata from each grant page, transforms the result into a transposed matrix (so that deadlines appear as rows and grants as columns), and writes the resulting data frame to an Excel file using the xlsx package.

Usage

write_nih_deadlines_excel(urls, output_path)

Arguments

urls

A character vector of NIH grant opportunity page URLs.

output_path

A character string specifying the full file path (including filename) for the output Excel file.

Details

The transformation process involves:

  1. Converting the resulting wide tibble (with one row per grant) into a matrix.

  2. Setting the URL values as row names.

  3. Replacing NA values with empty strings for aesthetics.

  4. Transposing the matrix so that deadline dates become row labels and metadata columns become columns.

  5. Converting the transposed matrix back to a data frame and writing to an Excel file.

Value

Invisibly returns the final data frame written to Excel.

Examples

## Not run: 
  urls <- c("https://grants.nih.gov/grants/guide/pa-files/PAR-25-362.html", 
            "https://grants.nih.gov/grants/guide/pa-files/PAR-23-198.html")
  write_nih_deadlines_excel(urls, "./NIH_deadlines.xlsx")

## End(Not run)


eisascience/scCustFx documentation built on June 2, 2025, 3:59 a.m.