我想从以下网站下载曲棍球运动员的薪水 https://www.spotrac.com/nhl/rankings/
library(rvest)
url <- "https://www.spotrac.com/nhl/rankings/cash/"
df <- html_table(html_nodes(read_html(url), "table")[[1]], header = TRUE, fill = TRUE)
df
我只能下载100行,尽管表中总共有近1000行。页面上的代码显示总共100行。 在哪里找到以及如何下载其余部分? 谢谢你的任何想法 *我可以根据命令进行过滤并分部分下载,但这不方便
答案 0 :(得分:0)
我已经完成
library(rvest)
team = c('anaheim-ducks' , 'arizona-coyotes', 'boston-bruins', 'buffalo-sabres',
'calgary-flames', 'carolina-hurricanes', 'chicago-blackhawks',
'colorado-avalanche','columbus-blue-jackets', 'dallas-stars',
'detroit-red-wings', 'edmonton-oilers', 'florida-panthers',
'los-angeles-kings', 'minnesota-wild', 'montreal-canadiens',
'nashville-predators', 'new-jersey-devils', 'new-york-islanders', 'new-york-rangers',
'ottawa-senators', 'philadelphia-flyers', 'pittsburgh-penguins',
'san-jose-sharks', 'st-louis-blues', 'tampa-bay-lightning',
'toronto-maple-leafs','vancouver-canucks', 'vegas-golden-knights',
'washington-capitals','winnipeg-jets')
y <- NULL;
for(i in team) {
k=html_table(html_nodes(read_html(paste0('https://www.spotrac.com/nhl/rankings/cash/',i,'/')), "table")[[1]], header = TRUE)
k$team = i
y <- rbind(y, k)
}
y