Electron Musketeer
2014-Jul-15 15:24 UTC
Help with Download of a comma separated file in zip format
Dear Experts I am new to this forum and to R and was trying the following to access a zip file from the webpages of the NSE. Here is my code. temp <- tempfile() download.file(" http://www.nseindia.com/content/historical/DERIVATIVES/2014/JUL/fo09JUL2014bhav.csv.zip ",temp) con <- unz(temp, "a1.dat") data <- matrix(scan(con),ncol=4,byrow=TRUE) unlink(temp) The result is: cannot open URL ' http://www.nseindia.com/content/historical/DERIVATIVES/2014/JUL/fo09JUL2014bhav.csv.zip ' In addition: Warning message: In download.file(" http://www.nseindia.com/content/historical/DERIVATIVES/2014/JUL/fo09JUL2014bhav.csv.zip", : cannot open: HTTP status was '403 Forbidden' I tried accessing this file directly from the website and it is letting me access it. My question is why is it not letting me download from R? I have gone through some websites to see if this has been resolved but the older resolutions also do not work. Can someone help please? Thx Balaji [[alternative HTML version deleted]]