frauke
2014-Mar-18 19:29 UTC
[R] RCurl: How to select options in online form and download the data
Hi, I would like to download discharge data for thousands of rivers from this website: http://ida.water.usgs.gov/ida/available_records.cfm?sn=12340000 I have managed to fill in the blank spaces in the form (start and end time) using library(RCurl) url1<-"http://ida.water.usgs.gov/ida/available_records.cfm?sn=12340000" start<-"1990-10-13" end<-"2007-09-30" result <- postForm(url1, fromdate=start, todate=end) I get stuck on choosing an option on how to save the data in this piece of the page source code: <select name="rtype"> <option value="1">Save to file</option> <option value="2">Save to compressed file</option> <option value="3">Display in browser</option> </select> <input name="submit1" id="submit1" type="submit" value="Retrieve Data" /> I have three specific questions: How do I select option 1 or 3? How do I "click" the "Retrieve Data" button? How do I download the data? I think that downloading the data might be more feasible with option 3 (display in browser). Option 1 (Save to file) will bring up the standard dialogue asking me where on my computer to save the file. I don't know how to deal with this dialogue in R. Option 3 opens a new webpage with the URL: "http://ida.water.usgs.gov/ida/available_records_process.cfm" (Note the river ID 12340000 is not in this URL). I could save the webpage as a .txt file, but I don't know how to get to this webpage using R. In either case the RCurl option followLocation would seem helpful, but I cannot figure out how to tell R to save what is on the second webpage that the first refers to. Any help will be much appreciated. Frauke -- View this message in context: http://r.789695.n4.nabble.com/RCurl-How-to-select-options-in-online-form-and-download-the-data-tp4687062.html Sent from the R help mailing list archive at Nabble.com.