How to create a table from selected variables

I'm trying to do a Shiny App in which I can introduce any data and then, selecting the variables with which I wanna work, it return me a table in which I have the first colum the name of the variables that I selected, and the other colums be the mean, median, etc of the variables selected. Somthing like a summary.
This is what i got so far but i don't know how to make the table.

Thanks

library(shiny)
library(shinydashboard)

ui <- dashboardPage(
  dashboardHeader(),
  dashboardSidebar(
    sidebarMenu(
      menuItem("Data", tabName = "data", icon = icon("folder-open")),
      menuItem("Univariable", tabName = "univariable")  
    )
  ),
  dashboardBody(
    tabItems(
            tabItem(tabName = "data",
                    fileInput("file1", "Escull l'arxiu",
                              multiple = FALSE,
                              accept = c("text/csv",
                                         "text/comma-separated-values,text/plain",
                                         ".csv")),
                    helpText("Els arxius .csv s'ha de seleccionar separador punt i coma"),

                    #tags$hr(),
                    checkboxInput("header", "Cap├žalera", TRUE),
                    radioButtons("sep", "Separador",
                                 choices = c(Comma = ",",
                                             "Punt i coma" = ";",
                                             Tab = "\t"),
                                 selected = ","),


                    DT::dataTableOutput("contents")

      ),
      tabItem(tabName = "univariable",
              uiOutput("select"),
              DT::dataTableOutput("score_table")
              )
    )
  )
)



server <- function(input, output) {
  myData <- reactive({
    inFile <- input$file1
    if (is.null(inFile)) return(NULL)
    data <- read.csv(inFile$datapath, header = input$header,
                     sep = input$sep)
    data
  })

  output$contents <- DT::renderDataTable({
    DT::datatable(myData())
  })


  output$select <- renderUI({
    df <- myData()
    selectInput("numerical", "Select Numerical:",names(df), selected = NULL, multiple = TRUE)
  })

  output$score_table <- DT::renderDataTable({
    
  })
}

shinyApp(ui, server)

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.