I'm new to web-scraping. Was using the SelectorGadget and rvest to take the data from "https://fbref.com/en/comps/9/defense/Premier-League-Stats".
I'm unable to take the data from the players table.
The code I'm using
url <- "https://fbref.com/en/comps/9/defense/Premier-League-Stats"
def_stats <- url %>% read_html() %>% html_nodes("#stats_defense") %>% html_table()
But this is returning an empty list. If I use url %>% read_html() %>% html_table() it just returns the Teams stats table.
I tried using various css selectors, "#stats_defense", #div_stats_defense, and even selecting the individual columns of the table. But it's returning an empty list.