This function is used to scrape an html table from a website.
table_scrap(link, choose = 1, header = TRUE, askRobot = FALSE)
the link of the web page containing the table to scrape
an integer indicating which table to scrape
do you want the first line to be the leader (default to TRUE)
logical. Should the function ask the robots.txt if we're allowed or not to scrape the web page ? Default is FALSE.
a data frame object.
# \donttest{
# Extracting premier ligue 2019/2020 top scorers
link <- "https://www.topscorersfootball.com/premier-league"
table_scrap(link)
#> # A tibble: 5 × 6
#> `#` Player Team Nationality Age Goals
#> <dbl> <chr> <chr> <chr> <int> <int>
#> 1 1 Mohamed Salah Liverpool Egypt 32 29
#> 2 2 Alexander Isak Newcastle Sweden 25 23
#> 3 3 Erling Haaland Manchester City Norway 24 22
#> 4 4 Bryan Mbeumo Brentford France 25 20
#> 5 NA Chris Wood Nottingham Forest New Zealand 33 20
# }