How to render a DT::data.table and a wordcloud2::wordcloud2 in the mainPanel of a ShinyApp?
Here is a reproducible example. When I comment the wordcloud2 codes and adjust the code, the DT::data.table render normally.
# Only run examples in interactive R sessions
if (interactive()) {
library(wordcloud2)
n <- 1
# Define UI
ui <- fluidPage(
# Application title
titlePanel("titlePanel"),
sidebarLayout(
# Sidebar with a slider input
sidebarPanel(
textInput("user_input", h3("Field example"),
value = "value"),
numericInput('size', 'Size of wordcloud', n)
),
# Show a plot of the generated distribution
mainPanel(
tabsetPanel(type = "tabs",
tabPanel("DT + wordcloud2", DTOutput('tbl'),
wordcloud2Output('wordcloud2')),
tabPanel("Plot", plotOutput("plot")),
tabPanel("Summary",verbatimTextOutput("summary")),
tabPanel("about", tableOutput("table"))))))
# Server logic
server <- function(input, output) {
output$tbl = renderDT(
iris, options = list(lengthChange = FALSE))
output$wordcloud2 <- renderWordcloud2({
wordcloud2(demoFreq, size=input$size)})
}
# Complete app with UI and server components
shinyApp(ui, server)
}
I want a wordcloud2 centered below the DT::data.table.
Thanks in advance.