R 在“闪亮”中动态渲染长方体
如何根据数据以闪亮的方式渲染长方体。 数据是由用户上传的,它可以有比这更多的数据,所以我必须创建 一个盒子。 我正在运行下面的代码,我正在控制台中创建四个框,而不是在闪亮的网页中。 请看一看,谢谢 密码R 在“闪亮”中动态渲染长方体,r,shiny,shinydashboard,R,Shiny,Shinydashboard,如何根据数据以闪亮的方式渲染长方体。 数据是由用户上传的,它可以有比这更多的数据,所以我必须创建 一个盒子。 我正在运行下面的代码,我正在控制台中创建四个框,而不是在闪亮的网页中。 请看一看,谢谢 密码 list\u data看看这里,我在每个按钮上都添加了一个按钮,这样里面就有东西了 library(shinydashboard) library(shiny) list_data <- list(c("AB","CD","EF","GH")) #data ui <- dash
list\u data看看这里,我在每个按钮上都添加了一个按钮,这样里面就有东西了
library(shinydashboard)
library(shiny)
list_data <- list(c("AB","CD","EF","GH")) #data
ui <- dashboardPage(
dashboardHeader(title = "Text Mining"),
dashboardSidebar(
sidebarMenu(
menuItem("NLP Tree", tabName = "NLP")
)
),
dashboardBody(
tabItems(
tabItem(tabName = "NLP",
fluidRow(
tabBox(width = 12,height="500",
tabPanel("Sentences",
uiOutput("nlp_sentences_tree")
)
)
)
)
)
)
)
server <- function(input, output) {
v <- list()
for (i in 1:length(list_data[[1]])){
v[[i]] <- box(width = 8, list_data[[1]][i],actionButton(i,i))
}
output$nlp_sentences_tree <- renderUI(v)
}
shinyApp(ui = ui, server = server)
库(ShinydaShashboard)
图书馆(闪亮)
列表数据看看这里,我在每个按钮上都添加了一个按钮,这样里面就有东西了
library(shinydashboard)
library(shiny)
list_data <- list(c("AB","CD","EF","GH")) #data
ui <- dashboardPage(
dashboardHeader(title = "Text Mining"),
dashboardSidebar(
sidebarMenu(
menuItem("NLP Tree", tabName = "NLP")
)
),
dashboardBody(
tabItems(
tabItem(tabName = "NLP",
fluidRow(
tabBox(width = 12,height="500",
tabPanel("Sentences",
uiOutput("nlp_sentences_tree")
)
)
)
)
)
)
)
server <- function(input, output) {
v <- list()
for (i in 1:length(list_data[[1]])){
v[[i]] <- box(width = 8, list_data[[1]][i],actionButton(i,i))
}
output$nlp_sentences_tree <- renderUI(v)
}
shinyApp(ui = ui, server = server)
库(ShinydaShashboard)
图书馆(闪亮)
列出数据或带有lappy
和tagList
:
server <- function(input, output) {
output$nlp_sentences_tree <- renderUI({
a <- lapply(list_data[[1]], function(x) {
box(width = 8, x)
})
tagList(a)
})
}
server或带有lappy
和tagList
:
server <- function(input, output) {
output$nlp_sentences_tree <- renderUI({
a <- lapply(list_data[[1]], function(x) {
box(width = 8, x)
})
tagList(a)
})
}
服务器中存在一个错误:第一个参数无效
。删除actionButtons将删除该错误。或者用actionButton(如.character(i),i)
替换它。我没有收到错误,我在shinydashboard 1.1.0
和shinydashboard 0.7.0
上,我在shinydashboard 1.0.5
和相同的仪表板版本上。@PorkChop你在codementor上吗?你能帮我用闪亮模块的概念来做这个例子吗?我在exists:invalid first argument
中遇到了一个错误。删除actionButtons将删除该错误。或者用actionButton(如.character(i),i)
替换它。我没有收到错误,我在shinydashboard 1.1.0
和shinydashboard 0.7.0
上,我在shinydashboard 1.0.5
和相同的仪表板版本上。@PorkChop你在codementor上吗?你能用闪亮的模块概念来帮助制作这个例子吗?