2017-03-29 4 views
1

Ich versuche, Text Mining in R.Tm.plugin.webmining in R - Google News-Feeds

Ich Begegnung Probleme zu lernen, wenn es um die Verwendung des tm.plugin.webmining Pakets kommt, wenn zu meiner Google News versuchen und Finanzen Seiten (siehe Codes und Fehlermeldungen unten).

Ich würde jede mögliche Hilfe schätzen, die ich erhalten kann.

Mit GoogleNewsSource

googlenews <- WebCorpus(GoogleNewsSource("Microsoft")) 
Unknown IO errorfailed to load external entity "http://news.google.com/news?hl=en&q=Microsoft&ie=utf-8&num=100&output=rss" 
Error: 1: Unknown IO error2: failed to load external entity "http://news.google.com/news?hl=en&q=Microsoft&ie=utf-8&num=100&output=rss" 

library(tm.plugin.webmining) 
library(purrr) 

company <- c("Microsoft", "Apple", "Google", "Amazon", "Facebook", 
      "Twitter", "IBM", "Yahoo", "Netflix") 
symbol <- c("MSFT", "AAPL", "GOOG", "AMZN", "FB", "TWTR", "IBM", "YHOO", "NFLX") 

download_articles <- function(symbol) { 
    WebCorpus(GoogleFinanceSource(paste0("NASDAQ:", symbol))) 
} 

stock_articles <- data_frame(company = company, 
          symbol = symbol) %>% 
    mutate(corpus = map(symbol, download_articles)) 
failed to load HTTP resource 
Error in mutate_impl(.data, dots) : 1: failed to load HTTP resource 
+1

Willkommen bei Stack-Überlauf Pls gehen durch [Wie fragen] (https://stackoverflow.com/help/how-to-ask) – Prasad

Antwort

0

Das Problem ist in der NASDAQ:TWTR. Das Entfernen beider "Twitter" von company und "TWTR" von symbol behebt den Fehler.

company <- c("Microsoft", "Apple", "Google", "Amazon", "Facebook", "Netflix") 
symbol <- c("MSFT", "AAPL", "GOOG", "AMZN", "FB", "NFLX") 

download_articles <- function(symbol) { 
    WebCorpus(GoogleFinanceSource(paste0("NASDAQ:", symbol))) 
} 
stock_articles <- data_frame(company = company, 
          symbol = symbol) %>% 
    mutate(corpus = map(symbol, download_articles)) 
stock_articles 
#  # A tibble: 6 x 3 
#  company symbol   corpus 
#  <chr> <chr>   <list> 
# 1 Microsoft MSFT <S3: WebCorpus> 
# 2  Apple AAPL <S3: WebCorpus> 
# 3 Google GOOG <S3: WebCorpus> 
# 4 Amazon AMZN <S3: WebCorpus> 
# 5 Facebook  FB <S3: WebCorpus> 
# 6 Netflix NFLX <S3: WebCorpus> 
+0

empfehle ich werde https://www.google.com/ Finanzieren und suchen Sie nach einem bestimmten Unternehmen Ihres Interesses wie "Twitter". Dann bringt das Suchergebnis das richtige Symbol für Sie: NYSE: TWTR in diesem Fall. @raoul möchten Sie vielleicht diese Informationen zu Ihrer Antwort hinzufügen. –