I am extracting url links from 611 webpages. The code below helps me to download them. The problem is that I obtain the following error Error in if (grepl("<|>", x)) { : argument is of length zero
, which suddenly stops the process and do not return the desired list of links. How can I skip this error message and continue with the data collection process?
real.links <- paste0("http://www.bursamalaysia.com" ,links) # if necessary, I can provide the information of the vector 'links'
doc.link <- lapply(real.links, . %>%
read_html() %>% html_nodes("iframe") %>%
html_attr("src") %>% read_html() %>%
html_nodes("a") %>% html_attr("href") %>% print())
# When I inspect "print()", it seems that the function stops at the link 128
Aucun commentaire:
Enregistrer un commentaire