Normally I don't have any issues getting table data from sites, but this one is throwing me for a loop.
I've tried various suggestion from the site: [R: Scraping Site, Incrementing Loop by Date in URL, Saving To CSV [Scraping from aspx website using R [web scraping in R
I've tried the two methods to try and get something from the site and end up with errors.
The first approach:
#####Reading in data
library(RCurl)
library(XML)
library(xts)
#pulling rainfall data csv
direct_rainfall <- read.csv(url(getURL("http://cdec.water.ca.gov /cgi-progs/getMonthlyCSV?station_id=CVT&dur_code=M&sensor_num=2&start_date=1/1/2000&end_date=now")))
This ends with the following error: Error in function (type, msg, asError = TRUE) : Failed to connect to cdec.water.ca.gov port 80: Timed out
The second method:
#xml data pull method
require(XML)
url = "http://cdec.water.ca.gov/cgi-progs/getMonthlyCSV?station_id=CVT&dur_code=M&sensor_num=2&start_date=1/1/2000&end_date=now"
doc = htmlParse(url)
Which end with the following error: Error: failed to load external entity "http://cdec.water.ca.gov/cgi-progs/getMonthlyCSV?station_id=CVT&dur_code=M&sensor_num=2&start_date=1/1/2000&end_date=now"
Any guidance would be appreciated. I just can't figure out why I'm getting nothing when I try and pull from the URL.
Thanks!