am trying to extract the words so that I can create a wordcloud but have some difficulties this is the code:
library(readxl)
data <- read_excel("C:\\Users\\me\\OneDrive\\Desktop\\ToPandas.xlsx")
data2 <-data$articlesDescription
#install.packages("wordcloud2")
#install.packages("tidyverse")
#install.packages("tidytext")
library(wordcloud2)
library(tidyverse)
library(tidytext)
data2 <- gsub('[^[:alnum:] ]', '', data2)
data2 <- data2 %>%
ungroup()
data3.df <- as.data.frame(data2)
data3 <- data3.df
data3 <- data3%>%
anti_join(get_stopwords())%>%
unnest_tokens(word, text) %>%
count(word, sort = TRUE)
I have put the hash tags in front of the install packages so it does not try to reinstall. up to data2 until I start to ungroup then I get this error:
Error in UseMethod("ungroup") : no applicable method for 'ungroup' applied to an object of class "character"
then when it tries to move forward I get this:
Error in
anti_join(): !bymust be supplied whenxandyhave no common variables. i use by = character()` to perform a cross-join.
I think that my error stems from the first error (ungroup) but I can't figure out how to do it so I can count the words
this is a sample of how the imported xlsx file looks like: ToPandas_xlsx Image
Can anyone point me into the right direction? thanks :)