I'm trying to import a database from the same website but in different tabs.
# webscraping para idh
algo <- c(1996:2017)
idh_link <- c(paste0("https://datosmacro.expansion.com/idh?anio=", 1996:2017))
final <- vector(length = length(idh_link))
for (i in seq_along(algo)) {
idh_desc <- read_html(idh_link[i])
pais <- idh_desc %>%
html_nodes("td:nth-child(1), .header:nth-child(1)") %>%
html_text()
idhaño <- idh_desc %>%
html_nodes("td:nth-child(2), .header:nth-child(2)") %>%
html_text()
final[i] <- tibble(pais, idhaño)
}
In this case, it only recovers the information from the first link and doesn't create the tibble at the end of the loop (the idea is to do a innerjoin with all the tibbles).
I'm using library(rvest) for the webscraping