Hi,
I was working with the R shiny dashboard and trying to add a data collection table in the shiny through renderDataTable
in the code, however, the app runs and closes immediately (see the error message below). I am also including the ui.R
and server.R
code for reference along with the simple data table. Please assist me.
Thank you,
Toufiq
ui.R
library(shinydashboard)
library(shiny)
library(ggplot2)
library(DT)
load("Expt_data.RData")
ui <- dashboardPage(skin = "blue",
dashboardHeader(title = "Test", titleWidth = 300),
dashboardSidebar(
width = 300,
sidebarMenu(
menuItem("MENU")
),
sidebarMenuOutput("menu")
),
dashboardBody(
tabItems(
tabItem("gd_dat",
h5("comparison analysis (Disease vs. Healthy Control)"),
fluidRow(
box(width = NULL,solidHeader = TRUE,
plotOutput("plot2", height = 500)
)
)
),
tabItem("datatable",
h5("This a data collection table "),
fluidRow(
box(width = NULL,solidHeader = TRUE,
dataTableOutput("datatable", height = 500)
))
)
)
)
)
server.R
server = function(input, output) {
output$menu <- renderMenu({
sidebarMenu(
menuItem("FINGERPRINT GRIDS", tabName = "gd_dat"),
menuItem("Choose disease", icon = icon("bar-chart-o"),
# Input directly under menuItem
selectInput(inputId = "diseaseInput",
label = "",
choices = unique(df_app_MT$diseases), multiple=F, selectize=TRUE,
width = '98%'), tabName = "gd_dat"),
## Load datatable
menuItem("DATASET COLLECTION", tabName = "datatable"),
# Input directly under menuItem
output$datatable = renderDataTable(Data_Collection_Release)
)
})
}
dput(Data_Collection_Release)
structure(list(Dataset = c("Dataset_1", "Dataset_2", "Dataset_3",
"Dataset_4", "Dataset_5", "Dataset_6"), Group = c("A", "A", "A",
"B", "B", "B"), Functional = c("Yes", "Yes", "Yes", "No", "No",
"No"), Comments = c("NA", "NA", "NA", "NA", "NA", "NA")), class = c("tbl_df",
"tbl", "data.frame"), row.names = c(NA, -6L))
#> # A tibble: 6 × 4
#> Dataset Group Functional Comments
#> <chr> <chr> <chr> <chr>
#> 1 Dataset_1 A Yes NA
#> 2 Dataset_2 A Yes NA
#> 3 Dataset_3 A Yes NA
#> 4 Dataset_4 B No NA
#> 5 Dataset_5 B No NA
#> 6 Dataset_6 B No NA
Error
Error in parse(file, keep.source = FALSE, srcfile = src, encoding = enc) :
/Users/mtd/Documents/Documents/Datasets/Shiny_Applicati:14:34: unexpected '='
13: # Input directly under menuItem
14: output$datatable =
Created on 2021-10-19 by the reprex package (v2.0.1)