因此,我正在编写一个带有R的网络刮刀来搜索zillow,了解西澳州每个县的房屋中值.我正在使用rvest包,这里是有问题的代码:
URL <- "https://en.wikipedia.org/wiki/List_of_counties_in_Washington"
wiki <- html(URL)
#Getting the list of counties in WA
counties <- wiki %>%
html_nodes(".wikitable td:nth-child(1) a") %>%
html_text()
#Putting together a list to pull my search terms from
searchTerms <- list()
for(i in 1:length(counties)) {
searchTerms[[i]] <- paste0(counties[i], ", WA", sep="")
}
searchTerms <- gsub(",", "", searchTerms)
searchTerms <- gsub(" ", "-", searchTerms)
homeValues <- list()
#Getting the HTML for each county using the search terms in the URL,
#eventually it will pull the homeValues …Run Code Online (Sandbox Code Playgroud)