Closed chitemerere closed 6 years ago
I am trying to web scrap a table wit multiple pages with R using the following code:
library(rvest) library(plyr)
fetchAll <- function(page) { url <- paste0("https://www.zauba.com/export-trimethoprim/fp-zimbabwe/p-", page, "-hs-code.html") url2 <- read_html(url) url3 <- url2%>%html_nodes("table")%>%.[1]%>%html_table(fill = TRUE) url4 <- data.frame(url3) }
allData <- ldply(1:4, fetchAll, .progress="text")
View(allData)
The output only shows the results of the first page only. Please assist
is is related with archivist?
not related to archivist you may be interested in the harvest package
I am trying to web scrap a table wit multiple pages with R using the following code:
library(rvest) library(plyr)
fetchAll <- function(page) { url <- paste0("https://www.zauba.com/export-trimethoprim/fp-zimbabwe/p-", page, "-hs-code.html") url2 <- read_html(url) url3 <- url2%>%html_nodes("table")%>%.[1]%>%html_table(fill = TRUE) url4 <- data.frame(url3) }
allData <- ldply(1:4, fetchAll, .progress="text")
View(allData)
The output only shows the results of the first page only. Please assist