On this code when I use for loop or the function lapply I get the following error
"Error in get_entrypoint (debug_port):
  Cannot connect R to Chrome. Please retry. "
library(rvest)
library(xml2) #pull html data
library(selectr) #for xpath element
url_stackoverflow_rmarkdown <- 
  'https://stackoverflow.com/questions/tagged/r-markdown?tab=votes&pagesize=50'
web_page <- read_html(url_stackoverflow_rmarkdown)
questions_per_page <- html_text(html_nodes(web_page, ".page-numbers.current"))[1]
link_questions <- html_attr(html_nodes(web_page, ".question-hyperlink")[1:questions_per_page], 
                            "href")
setwd("~/WebScraping_chrome_print_to_pdf") 
for (i in 1:length(link_questions)) {
  question_to_pdf <- paste0("https://stackoverflow.com",
                            link_questions[i])
  pagedown::chrome_print(question_to_pdf) 
}
Is it possible to build a for loop() or use lapply to repeat the code from where it break? That is, from the last i value without breaking the code?
Many thanks
 
    