Hi,
I hope you can help me out with my below request.
Thank you very much in advance for your time and help. Very much appreciated.
I’d like to generate my wordcloud in Shiny with a drop down menu where I can select the wordcloud I want to populate.
I have two wordclouds (“1”, “2”)
addresses <<- list("1" = "w1", "1 = "w2")
I have populate the below code which doesn’t let me populate the wordcloud and apply the drop down menu.
Shiny code
library(shiny)
ui <- fluidPage(
titlePanel("Wordcloud"),
sidebarLayout(
sidebarPanel(
selectInput("selection", "Choose an address:",
choices = addresses),
actionButton("update", "Change"),
hr(),
sliderInput("freq",
"Minimum Frequency:",
min = 1, max = 50, value = 15),
sliderInput("max",
"Maximum Number of Words:",
min = 1, max = 300, value = 100)
),
mainPanel(
plotOutput("plot")
)
)
)
``
server<- function(input, output, session) {
terms <- reactive({
input$update
isolate({
withProgress({
setProgress(message = "Processing corpus...")
input$selection
})
})
})
wordcloud_rep <- repeatable(wordcloud)
output$plot <- renderPlot({
v <- terms()
wordcloud_rep(names(v), v, scale=c(4,0.5),
min.freq = input$freq, max.words=input$max,
colors=brewer.pal(8, "Dark2"))
})
}
shinyApp(ui, server)
Thanks,
Juanma