library(fs)
library(readxl)
#' @title Import statistics from file
#'
#' @description This function aims at importing statistical data from an Excel file.
#' @param sourceFilePath The path where the Excel file can be found.
#' @keywords import
#' @export
import_from_file <- function(sourceFilePath){
# Check if file exists
# check if file is a directory
# check if file extension is supported
stopifnot(file.exists(sourceFilePath),
!fs::is_dir(sourceFilePath),
fs::path_ext(sourceFilePath) %in% c('xlsx', 'xls')
)
# Import from Excel
content <- readxl::read_excel(sourceFilePath)
# return content
return(content)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.