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) +
coord_flip()+
theme_classic()+
labs(title = "Count of Complaints Types for Twitter Shares",
subtitle = "Most frequent Complaints by structure_type", y = "Count of Tweets", x = "")
}
output$plot3 <- renderPlot({
withProgress({
setProgress(message = "Processing Barplot")
plot_hist(tweets())
})
})
#> Error in renderPlot({: could not find function "renderPlot"
Created on 2020-08-07 by the reprex package (v0.3.0)