对不起,
我有如下四个数据
Patient_005=as.data.frame(read.table(text = " Driver SNV_Tumour_005 SNV_Organoid_005 INDEL_Tumour_005 INDEL_Organoid_005 Deletion_Organoid_005
ABCB1 * * * - - -
ACVR1B * * - - - -
ACVR2A * - - - - -
"))
Patient_013=as.data.frame(read.table(text = " Driver SNV_Tumour_013 SNV_Organoid_013 INDEL_Tumour_013 INDEL_Organoid_013 Deletion_Tumour_013 Deletion_Organoid_013
ABCB1 * - * - - - -
ACVR1B * - - - - - -
ACVR2A * - - - - - -
"))
Patient_036 = as.data.frame(read.table(text = " Driver SNV_Organoid_036 INDEL_Organoid_036 Deletion_Organoid_036
ABCB1 * - * -
ACVR1B * * * -
ACVR2A * * - -
"))
Patient_021 = as.data.frame(read.table(text = " Driver SNV_Organoid_021 INDEL_Organoid_021
ABCB1 * * -
ACVR1B * * -
ACVR2A * * *
"))
在下面的闪亮应用程序中,我想在下拉菜单中显示与每个患者相关的数据表,但我不知道该怎么做。例如在OAC menuItem中并通过单击患者005,我希望显示相应的表格
dropdownActionMenu <- function (..., title=NULL, icon = NULL, .list = NULL, header=NULL) {
items <- c(list(...), .list)
lapply(items, shinydashboard:::tagAssert, type = "li")
type <- "notifications" # TODO créer action + CSS
dropdownClass <- paste0("dropdown ", type, "-menu")
tags$li(class = dropdownClass, a(href = "#", class = "dropdown-toggle",
`data-toggle` = "dropdown", icon, title), tags$ul(class = "dropdown-menu",
if(!is.null(header)) tags$li(class="header",header),
tags$li(tags$ul(class = "menu", items))))
}
actionItem = function (inputId, text, icon = NULL, tabSelect=FALSE) {
if(!is.null(icon)) {
shinydashboard:::tagAssert(icon, type = "i")
icon <- tagAppendAttributes(icon, class = paste0("text-", "success"))
}
if(tabSelect) {
tags$li(a(onclick=paste0("shinyjs.tabSelect('",inputId,"')"),icon,text))
} else {
tags$li(actionLink(inputId,text,icon))
}
}
bodyHome <- tabItem(tabName = "main", value="main_panel",
fluidRow(
box(
tags$head(tags$link(rel="shortcut icon", href="favicon.ico")),
tags$script(src = "js/google-analytics.js"),
title = "Welcome to OAC modeling by organoid culture", width = 12, status = "primary",
HTML("<b>Shiny App</b> University of Southampton
")
)
),
fluidRow(
box(
title = "Introduction", width = 4, status = "warning",
p("Metadata of patients"),
#p("Using battle option one can generate up-to 9 sets."),
img(src='venn_module.png', align = "center", width="100%")
)
)
)
ui <- dashboardPage(
dashboardHeader(
dropdownActionMenu(title="Menu",
actionItem("mnuFirst","Main"),
actionItem("mnuSecond","OAC"),
actionItem("mnuFirst","COAD")
)
),
dashboardSidebar(width = 150,
sidebarMenu(
menuItem("Dashboard", tabName = "main", icon = icon("dashboard")),
menuItem("COAD", tabName = "COAD", icon = icon("venus-mars"),dropdownActionMenu(title="Patients",
actionItem("mnuFirst","005"),
actionItem("mnuSecond","036"),
actionItem("mnuFirst","013"),
actionItem("mnuSecond","036")
)),
menuItem("OAC", tabName = "OAC", icon = icon("venus-mars"),dropdownActionMenu(title="Patients",
actionItem("mnuFirst","005"),
actionItem("mnuSecond","036"),
actionItem("mnuFirst","013"),
actionItem("mnuSecond","036")
))
)),
dashboardBody(
tabItems(bodyHome)
)
)
shinyServer(function(input, output, session){
output$Table1 <- DT::renderDataTable({
datatable(iris)
})
})
shinyApp(ui, server)
我能够在menuitem中创建下拉菜单;现在,我需要在下拉菜单中显示与每个患者相关的数据表,但我不知道该怎么做