Displaying 2 results from an estimated 2 matches for "ddmmyy".
Did you mean:
ddmmmyy
2007 Oct 16
1
try / tryCatch for download.file( ) within a for loop when URL does not exist
...Xlt(as.Date("2007-10-15", "%Y-%m-%d"))
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...
2007 Oct 15
1
String concatenation, File Path Handling to pass to download.file( ) [backslash in DOS paths]
...#begin script
date <- as.POSIXlt(Sys.time()) #present 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.un...