Open beginner984 opened 5 years ago
Sorry,
I have four data like below
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 * * * "))
In below shiny app I want to display data table related to each patient in drop down menu but I don't know how to do that; For example in OAC menuItem and by clicking on patient 005 I want to corresponding table being shown
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)
Can you please help me?
Sorry,
I have four data like below
In below shiny app I want to display data table related to each patient in drop down menu but I don't know how to do that; For example in OAC menuItem and by clicking on patient 005 I want to corresponding table being shown
Can you please help me?