I scraped a website already and made a dataframe from it that only contains a column called "racenames" in this example. Each row has its own link that works if I were to take it and put it into a browser, this column is called "realtest.Event". How do I create a scraper that goes through my dataframe of links one by one? I'm not sure if a for loop is the way to go about this or not. If I can use a for loop, what am I doing wrong?
res_all <- NULL
for (realtest.Event in racename) {
urlrunning = paste0(realtest.Event)
scrapinghere = read_html(urlrunning)
putithere <- tibble(
bubba = scrapinghere %>% html_nodes("#sites-canvas-main-content td:nth-child(2)") %>% html_text(),
bubba2 = scrapinghere %>% html_node("#sites-canvas-main-content td:nth-child(1)")) %>% html_text()
res_all <- bind_rows(res_all, putithere)
}
My error I'm currently getting is... Error: x
must be a string of length 1