使用rvest在R中刮表
我无法在下面提到的链接中刮取该表,我已经检查了源代码,并注意到该表的类名为:tablesaw sortable 我在wikipedia页面上测试了下面的方法,它能够提取表,有没有任何方法可以读取特定的表使用rvest在R中刮表,r,R,我无法在下面提到的链接中刮取该表,我已经检查了源代码,并注意到该表的类名为:tablesaw sortable 我在wikipedia页面上测试了下面的方法,它能够提取表,有没有任何方法可以读取特定的表 url <- read_html("https://www.wunderground.com/history/airport/KNYC/2015/01/01/DailyHistory.html?HideSpecis=0") weather_hourly <- url %>%
url <- read_html("https://www.wunderground.com/history/airport/KNYC/2015/01/01/DailyHistory.html?HideSpecis=0")
weather_hourly <- url %>%
html_nodes(xpath='//*[@class="tablesaw-sortable"]') %>%
html_table()
url%
html_表()
好的,像这样的东西会让你非常接近你想要去的地方
library("httr")
URL <- "https://www.timeanddate.com/weather/usa/new-york/historic?month=8&year=2018"
temp <- tempfile(fileext = ".html")
GET(url = URL, user_agent("Mozilla/5.0"), write_disk(temp))
library("XML")
df <- readHTMLTable(temp)
df <- df[[2]]
df
库(“httr”)
URL如果你想获取地下天气数据,我建议你试试。@MrFlick他们不再发布免费的API密钥如果你想查找历史数据,我建议你访问NOAA.gov()。weatherunderground重新设计了他们的站点,从而破坏了大多数工具/脚本。@Dave2e感谢您,在使用RSelenium软件包的连续日期的刮取数据上找到了相同的信息。