Download a file from url
you can use RCurl for web connections from Duncan Lang, see its paper: http://www.omegahat.org/RCurl/RCurlJSS.pdf getURL there will solve your problem.
On Sun, Nov 18, 2012 at 2:07 AM, veepsirtt <veepsirtt at gmail.com> wrote:
Hi R, I installed wget and tried to download the file from this http://nseindia.com/content/equities/scripvol/datafiles/16-11-2012-TO-16-11-2012ACCEQN.csv but it fails. How to get it using wget? thanks veepsirtt #Define Working Directory, where files would be saved setwd('G:/NIFTY') #Define start and end dates, and convert them into date format startDate = as.Date("2011-01-05", order="ymd") endDate = as.Date("2011-02-01", order="ymd") f <- tempfile() downloadfilename=paste("ACC", "EQN", sep = "") temp ="" #Generate URL http://nseindia.com/content/equities/scripvol/datafiles/16-11-2012-TO-16-11-2012ACCEQN.csv myURL = paste("http://nseindia.com/content/equities/scripvol/datafiles/", as.character(startDate, "%d-%m-%Y"), "-TO-", as.character(endDate, "%d-%m-%Y"), downloadfilename, ".csv", sep = "") download.file(myURL, f, method='wget', extra="-U 'Mozilla/5.0 (X11; Linux) Gecko Firefox/5.0'") temp <- read.csv(f, sep = ",") head(temp) -- View this message in context: http://r.789695.n4.nabble.com/Download-a-file-from-url-tp4642985p4649907.html Sent from the R help mailing list archive at Nabble.com.
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.