I will appreciate very much your help fixing this issue: my code aims to read the data set, an Excel file (xlsx), from the internet. However, while running the code, it ends up with errors.
So, my code is:
library(xlsx)
# The link below does exist and the file is downloadable via a browser
l <- "https://www.rbnz.govt.nz/-/media/ReserveBank/Files/Statistics/tables/b2/hb2-daily.xlsx"
# 1st way to read the data...
read.xlsx(l, sheetName = "Data", startRow = 5)
# ... it produces an ERROR:
# Error in loadWorkbook(file, password = password) :
# Cannot find https://www.rbnz.govt.nz/-/media/ReserveBank/Files/Statistics/tables/b2/hb2-daily.xlsx
# 2nd way to read the data...
perl1 <- "C:/Strawberry/perl/bin/perl.exe"
options(java.parameters = "-Xmx1000m")
tmp <- tempfile()
download.file(l, destfile=tmp, method="curl")
rbnz.rates <- read.xlsx(file = tmp, sheetName = "Data", startRow = 5)
unlink(tmp)
# ... it produces an ERROR:
# Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl, :
# java.lang.IllegalArgumentException: Your InputStream was neither an OLE2 stream, nor an OOXML stream