Created
June 12, 2015 14:55
-
-
Save cpsievert/57be009120bb5298affa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(rvest) | |
src <- html("http://www.wunderground.com/history/airport/KVAY/2015/2/17/DailyHistory.html?req_city=Cherry+Hill&req_state=NJ&req_statename=New+Jersey&reqdb.zip=08002&reqdb.magic=1&reqdb.wmo=99999&MR=1") | |
# easy solution | |
tab1 <- src %>% html_node("#obsTable") %>% html_table() | |
# medium solution | |
tab2 <- src %>% html_node("#historyTable") %>% html_table() %>% .[2:4, "Actual"] | |
# hard solution | |
link <- src %>% html_node("#history-graph-image img") %>% html_attr("src") | |
download.file(paste0("http://www.wunderground.com", link), "fig.png") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment