2

tidytextパッケージを使用して、「ngrams」で列を作成したいと考えています。次のコードを使用します。

library(tidytext)

unnest_tokens(tbl = president_tweets,
              output =  bigrams,
              input = text,
              token = "ngrams", 
              n = 2) 

しかし、これを実行すると、次のエラー メッセージが表示されます。

error: unnest_tokens expects all columns of input to be atomic vectors (not lists)

私のtextコラムは、次のような行を持つ多くのツイートで構成されており、クラスのキャラクターです。

president_tweets$text <– c("The United States Senate just passed the biggest in history Tax Cut and Reform Bill. Terrible Individual Mandate (ObamaCare)Repealed. Goes to the House tomorrow morning for final vote. If approved, there will be a News Conference at The White House at approximately 1:00 P.M.", 
    "Congratulations to Paul Ryan, Kevin McCarthy, Kevin Brady, Steve Scalise, Cathy McMorris Rodgers and all great House Republicans who voted in favor of cutting your taxes!", 
    "A  story in the @washingtonpost that I was close to rescinding the nomination of Justice Gorsuch prior to confirmation is FAKE NEWS. I never even wavered and am very proud of him and the job he is doing as a Justice of the U.S. Supreme Court. The unnamed sources dont exist!", 
    "Stocks and the economy have a long way to go after the Tax Cut Bill is totally understood and appreciated in scope and size. Immediate expensing will have a big impact. Biggest Tax Cuts and Reform EVER passed. Enjoy, and create many beautiful JOBS!", 
    "DOW RISES 5000 POINTS ON THE YEAR FOR THE FIRST TIME EVER - MAKE AMERICA GREAT AGAIN!", 
    "70 Record Closes for the Dow so far this year! We have NEVER had 70 Dow Records in a one year period. Wow!"
    )

- - - - -アップデート: - - - - -

sentimetrまたはexploratoryパッケージが競合を引き起こしたようです。これらなしでパッケージをリロードしたところ、再び機能するようになりました!

4

1 に答える 1