I am trying to develop a application, where the user can upload the file and prepare the file.
Therefore, I designed the dashboard with 2 sub menu items called Load and Prepare as you could see below.
In the first tab, I am trying to upload the file by the user.
In the second tab, Prepare I wanted to display the column names from the file selected by the user. for examples, if my data frame has column names (ID,Date,Accepeted,Rejected), then I want them to be listed in the prep tab.
Once listed, User should be able to select the datatype he wants.
Below is the snapshot of the dashboard I have created.
Here is the UI code :
ui<-dashboardPage(
  dashboardHeader(title = "Model"),
  dashboardSidebar(
    sidebarMenu(id="tabs",
                menuItem("Data", tabName = "data", icon = icon("table"),startExpanded = TRUE,
                         menuSubItem("Load", tabName = "data1"),
                         menuSubItem("Prep", tabName = "prep")
                ),
                menuItem("Visualisation",icon=icon("bar-chart-o"), tabName = "vis"),
                menuItem("Result", icon=icon("cog"), tabName = "result")
    )
  ),
  dashboardBody(
    tags$style(type="text/css",
               ".shiny-output-error { visibility: hidden; }",
               ".shiny-output-error:before { visibility: hidden; }"
    ),
    tabItems(
      tabItem(tabName = "data1",
              fluidPage(
                fluidRow(
                  fileInput("file1","Choose CSV File",
                            accept = c("text/csv",
                                       "text/comma-seperated-values, text/plain",
                                       ".csv")
                  ),
                  tags$hr(),
                  checkboxInput("header", "Header", TRUE),
                  radioButtons("sep","Separator",
                               choices=c(Comma=",",
                                         semicolon=";",
                                         Tab="\t"),
                               selected = ";")
                ),
                mainPanel(
                  uiOutput("tb")
                )
                )),
    #--------Sub menu Item 2-----------
    tabItem(tabName = "prep",
            h1("Preprocessing"),
            fluidPage(
              fluidRow(
                uiOutput("loaded_tb"),
                selectInput('data_option','Select Option',
                            label="Select the Variable",
                            list(
                              "Variable Attributes"="var_attr",
                              "Data Summary ='data_summary"
                            ))
              ),
              radioButtons("class_selection", label="Variables Modeification",
                           choices = list(Numeric="numeric",Factor="factor",
                                          Character ="character",
                                          Date="date"),
                           selected = "numeric"),
              selectInput('date_format', "Select the Date Format",
                          list(
                            YMD ="ymd",
                            YDM ="ydm",
                            MYD ="myd",
                            DMY ="dmy",
                            DYM ="dym"
                          )),
              tags$h5("Date Preview"),
              verbatimTextOutput('date_preview'),
              actionButton("var_modify", "Modify")
              ),
                 mainPanel(
                   uiOutput("Pre")
              )
            ))
  )
) 
Here is the server code:
server <- shinyServer(function(input,output){
  data <- reactive({
    file1 <- input$file1
    if(is.null(file1)){return()}
    read.csv(file = file1$datapath, sep=input$sep)
  })
  output$filedf <- renderTable({
    if(is.null(data())){return()}
    input$file1
  })
  output$sum <- renderTable({
    if(is.null(data())){return()}
    summary(data())
  })
  output$table <- renderTable({
    if(is.null(data())){return()}
    data()
  })
  output$tb <- renderUI({
    if(is.null(data())){return()}
    tabsetPanel(tabPanel("About file", tableOutput("filedf")),tabPanel("Data", tableOutput("table")),tabPanel("Summary", tableOutput("sum")))
  })
  #----- Data Preparation------
  output$Pre <- renderUI({checkboxGroupInput(inputId = "select_vars",
                                             choices = names(data))
  })
  data_sel <- reactive({
    req(input$select_vars)
    data_sel<- data()%>% select(input$select_var)
  })
})
shinyApp(ui,server)

 
    