I am working on my company's R Studio server and would like to access data published on the ONS website
I wrote a few lines that build the correct url but I'm blocked when trying to read the file from the url
Here's a simplified example (i.e. with URL hardcoded):
library(gdata)
currUrl <- "http://www.ons.gov.uk/file?uri=/peoplepopulationandcommunity/birthsdeathsandmarriages/deaths/datasets/weeklyprovisionalfiguresondeathsregisteredinenglandandwales/2017/publishedweek302017.xls"
data <- read.xls(currUrl)
I get the following error :
> ERROR: The certificate of www.ons.gov.uk' is not trusted. ERROR: The > certificate of www.ons.gov.uk' hasn't got a known issuer. Error > parsing file '/tmp/RtmpXou27y/file386f520067bd.xls'. Error in > xls2sep(xls, sheet, verbose = verbose, ..., method = method, : > Intermediate file '/tmp/RtmpXou27y/file386f4e7dd580.csv' missing! In > addition: Warning messages: 1: In download.file(xls, tf, mode = "wb") > : download had nonzero exit status 2: running command > ''/usr/bin/perl' > '/home/nr/R/x86_64-pc-linux-gnu-library/3.2/gdata/perl/xls2csv.pl' > '/tmp/RtmpXou27y/file386f520067bd.xls' > '/tmp/RtmpXou27y/file386f4e7dd580.csv' '1'' had status 255 Error in > file.exists(tfn) : invalid 'file' argument
After some research on the website I tried a few different things such as changing the http to https or trying to download the file before reading it but nothing seems to work. I get a similar error when trying to download the file before reading it.