I am trying to scrape a database containing information about previously sold houses in an area of Denmark. I want to retrieve information from not only page 1, but also 2, 3, 4 etc.
I am new to R but from an tutorial i ended up with this.
library(purrr)
library(rvest)
urlbase <- "https://www.boliga.dk/solgt/alle_boliger-4000ipostnr=4000&so=1&p=%d"
map_df(1:5,function(i){
cat(".")
page <- read_html(sprintf(urlbase,i))
data.frame(Address = html_text(html_nodes(page,".d-md-table-cell a")))
Price = html_text(html_nodes(page,".text-md-left+ .d-md-table-cell .text-right"))
Rooms = html_text(html_nodes(page,".d-md-table-cell:nth-child(5) .paddingR"))
m2 = html_text(html_nodes(page,".qtipped+ .d-md-table-cell .paddingR"))
stringsAsFactors = FALSE
}) -> BOLIGA.ROSKILDE
View(BOLIGA.ROSKILDE)
Which gives me the message:
Error in bind_rows_(x, .id) : Argument 1 must have names
Any help would be welcome