I am trying to create a package to download, import and clean data from the Dominican Republic Central Bank web page. I have done all the coding in Rstudio.cloud and everything works just fine, but when I try the functions in my local machine they do not work.
After digging a bit on each function, I realized that the problem was the downloaded file, it is corrupt.
I am including the first steps of a function just to illustrate my issue.
# Packages library(readxl) # file url. url <- paste0("https://cdn.bancentral.gov.do/documents/", "estadisticas/precios/documents/", "ipc_base_2010.xls?v=1570116997757") # termporary path file_path <- tempfile(pattern = "", fileext = ".xls") # downloading download.file(url, file_path, quiet = TRUE) # reading the file ipc_general <- readxl::read_excel( file_path, sheet = 1, col_names = FALSE, skip = 7 ) Error: filepath: C:\Users\Johan Rosa\AppData\Local\Temp\RtmpQ1rOT3\2a74778a1a64.xls libxls error: Unable to open file
I am using temporary but that is not the problem, you can try to download the file in your working directory and the problem persist.
I want to konw:
- Why this code works in rstudio.clowd and not local?
- What can I do to get the job done? (alternative approach, packages, functions)