library(RCurl)
library(XML)
getIDsByLetter =
function(letter = "A",
u = "http://cdec.water.ca.gov/cgi-progs/staMeta")
{
txt = getForm(u, station_id = letter)
doc = htmlParse(txt, encoding = "UTF8")
a = getNodeSet(doc, "//pre/a")
structure(XML:::trim(sapply(a, function(x) xmlValue(getSibling(x)))), names = sapply(a, xmlValue))
}
getStationIDs =
function(letters = LETTERS)
{
unlist(lapply(letters, getIDsByLetter))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.