R/update_file.R

Defines functions update_file

Documented in update_file

#' Update file
#'
#' \code{update_file} Updates price history of crude and petroleum product prices
#'
#' @param path1 is a directory path from which the file to be loaded
#' @param path2 is a directory path to which the file to be saved
#' @param filename is a price history file names
#' @param sheetname is a name of sheet to be loaded
#'
#' @return saving updated file as rda format
#' @export
#'
#' @examples
#' update_file()
update_file <- function(path1 = "P:/LICS/Rwd", path2 = "P:/LICS/Rwd/Crack_analysis/data", filenm = "price_history", sheetnm = "Loading") {

  ##### Load updated file by using MarketView
  setwd(path1)
  crack_raw <- readxl::read_excel(path = paste(filenm, ".xlsx", sep = ""), sheet = sheetnm, col_names = TRUE, skip = 2, na = "", col_types = c("text"))

  ##### Save file as rda format
  setwd(path2)
  save(crack_raw, file = "price_history.rda")
}
skylics/crack_analysis documentation built on May 23, 2018, 11:18 a.m.