no applicable method for 'mutate_' applied to an object of class "c('SimpleCorpus', 'Corpus')"

I am trying to make the code block below reactive but I keep getting error:
no applicable method for 'mutate_' applied to an object of class "c('SimpleCorpus', 'Corpus')" Pls help out

plot_hist <- function(tweet.corpus){
  t <- tweet.corpus %>%
    mutate(structure_type = case_when(
      str_detect(text, "fault|fallen|transformer|wire|darkness") ~ "technical",
      str_detect(text,"meter|bill|reconciliation|payment") ~ "non-technical",
      True ~ "additional review"))
  t %>%
    count(structure_type, sort =T) %>%
    mutate(structure_type = reorder(structure_type, n)) %>%
    ggplot(aes(x = structure_type, y = n)) +
    geom_col() +
    xlab(NULL) +
    labs(title = "Count of Complaints Types for Twitter Shares",
         subtitle = "Most frequent Complaints by structure_type", y = "Count of Tweets", x = "")

output$plot3 <- renderPlot({
    setProgress(message = "Processing Barplot")
#> Error in renderPlot({: could not find function "renderPlot"

Created on 2020-08-07 by the reprex package (v0.3.0)

Mutate is for dataframes...not corpus objects.
I think you need to make a dataframe out of it first.

Thanks. How do I subset the text column from the data frame for my manipulation with mutate ()??

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.