I am trying and failing to get the following process to complete in R Version 3.1.2:
library(RCurl)
library(XLConnect)
yr <- substr(Sys.Date(), 1, 4)
mo <- as.character(as.numeric(substr(Sys.Date(), 6, 7)) - 1)
temp <- tempfile()
temp <- getForm("http://strikemap.clb.org.hk/strikes/api.v4/export",
FromYear = "2011", FromMonth = "1",
ToYear = yr, ToMonth = mo,
`_lang` = "en")
CLB <- readWorksheetFromFile(temp, sheet=1)
unlink(temp)
I have been able manually to export the requested data set and then read it into R from a local directory using the same readWorksheetFromFile syntax. My goal now is to do the whole thing in R. The call to the API seems to work (thanks to some earlier help), but the process fails at the next step, when I try to ingest the results. Here's what happens:
> CLB <- readWorksheetFromFile(temp, sheet=1)
Error in path.expand(filename) : invalid 'path' argument
Any thoughts on what I'm doing wrong or what's broken?