1
IMDBデータをスクラップしようとしていますが、1つの変数に対してエラーが発生し続けます。私は(コードのように)試みでそれを行うと、私は誰が間違って何が起こっているか/なぜ私に言うことができればそれは素晴らしいことだRStudio:(...)は長さ1のアトムベクトルエラーではありません
budget
[1] "Error : cannot convert object to a data frame\n" attr(,"class") [1] "try-error" attr(,"condition")
を取得
Error: Result 28 is not a length 1 atomic vector
library(rvest)
library(purrr)
library(tidyr)
topmovies <- read_html("http://www.imdb.com/chart/top")
links <- topmovies %>%
html_nodes(".titleColumn") %>%
html_nodes("a") %>%
html_attr("href") %>%
xml2::url_absolute("http://imdb.com")
pages <- links %>% map(read_html)
budget <- try(pages %>%
map_chr(. %>%
html_nodes("#titleDetails .txt-block:nth-child(11)") %>%
html_text() %>%
#gsub("\\D", "", .) %>%
extract_numeric()),silent=TRUE)
試行はその結果をスキップしているだけではありませんか?ありがとうございました!
すでに投稿された回答はどうなりましたか? – erocoar