Search code examples
text-miningtidymodels

Tibble error (Tibble columns must have compatible sizes.)


I have been trying to run the updated code provided at GitHub by Dr. Silge in "Text Mining with R: A tidy approach" for the example "Mining Financial Articles".

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 <- tibble(company = company,
                         symbol = symbol) %>%
  mutate(corpus = map(symbol, download_articles))

However, after running the tibble function, it gives me the following error:

Tibble columns must have compatible sizes. Size 8: Existing data. • Size 9: Column symbol. ℹ Only values of size one are recycled.

Does anyone know how to fix this?

Thanks!


Solution

  • The tm.plugin.webmining package has not been updated in a long time and no longer connected to the resources it needs, unfortunately. The code in the book still runs because we recorded what this package did return at the time that we wrote the book; the book uses that older result. We are tracking this needed update on GitHub and thinking about a good replacement.