title: Printing results of Cox Model in Shiny App
body: <p>I am attempting to add the results of a Cox model to an R Shiny app. 
  Unfortunately the results aren't printing out with the following line of code:</p>
  
  <pre><code> textOutput('modelSummary')
  </code></pre>
  
  <p>Also, I would like to add optional covariates via check-boxes. For example, I'm interested in adding something like the following below the last 'selectInput':</p>
  
  <pre><code>  checkboxGroupInput("variable", "Covariates:",
                       c("Covariate 1" = "cov1",
                         "Covariate 2" = "cov2",
                         "Covariate 3" = "cov3"))
  </code></pre>
  
  <p>and then adding the selected variables to the Cox model. </p>
  
  <p>The full Shiny App is below:</p>
  
  <pre><code>#
  # This is a Shiny web application. You can run the application by clicking
  # the 'Run App' button above.
  #
  # Find out more about building applications with Shiny here:
  #
  #    http://shiny.rstudio.com/
  #
  library(shiny)
  library(survival)
  library(survminer)
  library(ggplot2)
  
  ui &lt;- fluidPage(
    sidebarLayout(
      sidebarPanel(
        fileInput("file","File input"),
  
        selectInput("Survival",
                    label = "Length of Survival",
                    choices =  c('survival1',
                                 'survival2'),
                    selected = 'survival1'),
  
        selectInput("Treatment",
                    "Treatment",
                    choices = c("treatment1", "treatmentt2"),
                    selected = "treatment1"),
  
        selectInput("Endpoint",
                    "Endpoint",
                    choices = c("endpoint1", "endpoint2"),
                    selected = "endpoint1")
  
      ),
      mainPanel(
        plotOutput("KM"), 
        textOutput('modelSummary')
      )
    )
  )
  
  server &lt;- function(input, output) {
    options(shiny.maxRequestSize=40*1024^2)
    raw_surv_data &lt;- reactive({
      req(input$file)
      read.csv(input$file$datapath)
    })
  
    surv_data &lt;- reactive({
      raw_surv &lt;- raw_surv_data()
      data.frame(
        Time = raw_surv[[input$Survival]],
        Treatment    = raw_surv[[input$Treatment]],
        Endpoint  = raw_surv[[input$Endpoint]]
      )
    })
  
  
    surv_fit &lt;- reactive({
  
      survfit(Surv(Time , Endpoint) ~ Treatment, data = surv_data())
    })
  
    output$KM &lt;- renderPlot({  
      ggsurvplot(surv_fit(), risk.table = TRUE, data = surv_data())
    })
  
    cox_fit &lt;- reactive({
    coxph(Surv(Time, Endpoint) ~ Treatment, data = surv_data())
    })
  
  
    output$modelSummary &lt;- renderPrint({
    summary(cox_fit)
    })
  
  
  }
  
  shinyApp(ui = ui, server = server)
  </code></pre>