你好,我是这个迷人的 r 世界的新手,我无法跳过不存在的 url,我该如何处理?并且不要标记为和错误,感谢您的帮助。
标题:“错误”作者:“FJSG”日期:“27/6/2020”输出:html_document
knitr::opts_chunk$set(echo = TRUE) 库(xml2) 图书馆(rvest) 图书馆(tidyverse) 图书馆(润滑) zora_core <- read_html("https://zora.medium.com/the-zora-music-canon-5a29296c6112") Los_100 <- data.frame(album = html_nodes(zora_core, "h1:not(#96c9)") %>% html_text() %>% str_trim(side = "both"), 解释 = html_nodes(zora_core, "强 em , p#73e0 强") %>% html_text() %>% str_remove_all("^by") %>% str_extract("[a-zA-Z].+(?=[(])") %>% str_trim(side = "both"), año = html_nodes(zora_core, "strong em , p#73e0 strong") %>% html_text %>% str_extract("([[:digit:]]){4}"), liga = paste0("https://en.wikipedia.org/wiki/",html_nodes(zora_core, "strong em , p#73e0 strong") %>% html_text() %>% str_remove_all("^by") %>% str_extract("[a-zA-Z].+(?=[(])") %>% str_trim(side = "both") %>% str_replace_all(" ","_")))
货物 <- 功能(网址){ perfil_raw <- read_html(url) data.frame(解释 = html_node(perfil_raw,“h1#firstHeading”)%>% html_text() %>% str_trim(side = "both")) }
lista <- Los_100$liga[1:16] # 位置 16 的 url 不存在如何避免 datos_personales <- map_df(lista,carga)