USAID-OHA-SI / fastR

Import COP19/20 FAST ER Tool
Other
0 stars 1 forks source link

fastR

Import COP19 FAST Tool & make tidy/usable

Travis build status

Installation

You can install the released version of fastR from GitHub with:

install.packages("devtools")

devtools::install_github("USAID-OHA-SI/fastR")

Use

The main function of fastR is to bring import a COP19 FAST Tool into R and make it tidy.

The import (run_fastR())works for the following tabs in the FAST:

In addition to importing each tab separately, you can also combine the following tabs using combo_fastR().

#load package
  library(fastR)

#FAST file path (.xls) [COP19]
   path <- "../Downloads/FAST Malawi Consolidated Zero Draft 02082019.xlsx"

#read in FAST
   df_fast <- run_fastR(path, "2 Intervention-E")

#read combined input
   df_combo <- combo_fastR(path)

You can use one of the map() functions from purrr package to read in multiple Data Packs and combine.

#load package
  library(purrr)

#identify all the FAST files
  files <- list.files("../Downloads/FAST_Tools", full.names = TRUE)

#read in all FAST files and combine into one data frame
  df_all <- map_dfr(.x = files,
                    .f = ~ run_fastR(.x, "2 Intervention-E"))

#read in combined sheets from all FAST files
  df_all_combo <- map_dfr(.x = files,
                          .f = ~ combo_fastR(.x))

Disclaimer: The findings, interpretation, and conclusions expressed herein are those of the authors and do not necessarily reflect the views of United States Agency for International Development. All errors remain our own.