0
我想在不同的文本(somename)中循环的每个结果。R For循环不必要的覆盖
现在循环覆盖;
library(rvest)
main.page <- read_html(x = "http://www.imdb.com/event/ev0000681/2016")
urls <- main.page %>% # feed `main.page` to the next step
html_nodes(".alt:nth-child(2) strong a") %>% # get the CSS nodes
html_attr("href") # extract the URLs
for (i in urls){
a01 <- paste0("http://www.imdb.com",i)
text <- read_html(a01) %>% # load the page
html_nodes(".credit_summary_item~ .credit_summary_item+ .credit_summary_item .itemprop , .summary_text+ .credit_summary_item .itemprop") %>% # isloate the text
html_text()
}
我怎么能以这样的方式,“我”从列表中添加文本TOT中的语句代码呢?
你需要一个空列表,将该文本存储在其各自的索引 – eLRuLL
中,但后来我只能得到文本中最后一个输入列表的结果 – nemja
您是否尝试过文本< - sapply(url,function(i){...}) '?(**编辑**:应该使用'lapply'来代替,保持每个元素完全包含在一个列表元素中。) – r2evans