Displaying 3 results from an estimated 3 matches for "bhavcopy".
2007 Oct 16
1
try / tryCatch for download.file( ) within a for loop when URL does not exist
...t;))
for (i in 1:difftime(as.POSIXlt(as.Date("2007-10-15",
"%Y-%m-%d")),"2007-10-01"))
{
if (date$wday != 0 & date$wday != 6) {
datestr <- as.character(date, "%d%m%y") #make date character string ddmmyy
url <- paste("http://www.bseindia.com/bhavcopy/eq",datestr,"_csv.zip",sep="")
file <- paste("C:/",datestr,"_csv.zip",sep="")
#options(show.error.messages = FALSE)
#options(warn = -1)
try(download.file(url, destfile = file, quiet = TRUE, mode = "wb"),
finally = cat("OK:...
2017 Aug 03
1
Strange behaviour to download zip file using R
Hi again,
I was trying to download stock market data from below link :
https://www.nseindia.com/products/content/equities/equities/archieve_eq.htm
Input choice :
Select Report: Bhavcopy
Date(DD-MM-YYYY): 03-03-2010
If you put manual input as above, then we will get option for manual
download of file :
cm03MAR2010bhav.csv.zip
However I then tried to use R to have some automatic download :
> download.file('https://www.nseindia.com/content/historical/EQUITIES/2010/MAR/cm03...
2007 Oct 15
1
String concatenation, File Path Handling to pass to download.file( ) [backslash in DOS paths]
...resent date
for (i in 1:difftime(as.POSIXlt(Sys.Date()),"2007-10-01"))
if (date$wday != 0 & date$wday != 6) #check whether weekday
{
datestr <- as.character(date, "%d%m%y") #make date
character string ddmmyy
url <- paste("http://www.bseindia.com/bhavcopy/eq",datestr,"_csv.zip",sep="")
file <- paste("C:\\Program
Files\\R\\R-2.5.0\\data"\",datestr,"_csv.zip",sep="")
download.file(url, destfile = file, mode = "wb")
zip.unpack(file, cat("C:\\Program Files\\R\\R-2.5.0\\data...