如何在 ShinyApp 的主面板中呈现 DT::data.table 和 wordcloud2::wordcloud2?
这是一个可重现的例子。当我注释 wordcloud2 代码并调整代码时, DT::data.table 正常呈现。
# 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)
}
我想要一个以 DT::data.table 为中心的 wordcloud2。
提前致谢。