在R中刮掉当前的天气数据

时间:2013-11-29 02:13:24

标签: r web-scraping weather tidy

我试图从intellecast.com抓取天气数据。我可以使用以下代码分解和整理一些数据,但它并不完美,我无法想出以有效的方式整合它的方法。基本上我需要创建一个向量或表,以便我可以管理信息。

# Scrape Weather Data

games.URL.stem = "http://www.intellicast.com/Local/Weather.aspx?location=USMD9906"
weat = readHTMLTable(games.URL.stem)
weat <- weat[[1]]
weat
#check factors 
str(weat)
weat$V1
### isolate and tidy data
WW <- gsub("\r\n","",weat$V1)
WW
WW <- WW[1]
WW
WW <- gsub("        "," ",WW)
WW
WW <- gsub("     "," ",WW)
WW
WW <- gsub("        "," ",WW)
WW
WW <- gsub("Report Text:.*$","",WW)
WW

0 个答案:

没有答案