#' Import template sheet(s)
#'
#' Read in a standard HFR submission, binding all tabs into one. Note that all
#' tabs must be in the same template format - all long, wide, or wide-limited.
#'
#' @param filepath filepath to submitted template
#'
#' @export
#'
#' @examples
#' \dontrun{
#' #identify whether template is long or wide
#' filepath <- "~/HFR/HFR_FY23_Oct_Moldova_20221015.xlsx"
#' df_hfr <- hfr_import(filepath) }
hfr_import <- function(filepath){
df <- filepath %>%
readxl::excel_sheets() %>%
stringr::str_subset("HFR") %>%
purrr::map_dfr(.f = ~ readxl::read_excel(filepath, sheet = .x, skip = 1, col_types = "text"))
#replaces the old name for mech_code
if("mechanismid" %in% names(df))
df <- dplyr::rename(df, mech_code = mechanismid)
return(df)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.