Guest User

Untitled

a guest
Jun 25th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. library(shiny)
  2. library(tidyverse)
  3. library(readxl)
  4. server <- function(input, output) {
  5.  
  6. names <- reactive({ read_excel(input$file1$name, sheet = 1,
  7. range = "A1:P1", col_names = TRUE)
  8. })
  9. }
  10.  
  11. library(shiny)
  12. library(shinythemes)
  13. ui <- fluidPage(
  14.  
  15. theme=shinytheme("readable"),
  16.  
  17. # App title ----
  18. titlePanel("App_1"),
  19.  
  20. # Sidebar layout with input and output definitions ----
  21. sidebarLayout(
  22.  
  23. # Sidebar panel for inputs ----
  24. sidebarPanel(
  25.  
  26.  
  27. # Input: Select a file ----
  28. fileInput("file1", "Choose File",
  29. multiple = FALSE),
  30.  
  31. # Horizontal line ----
  32. tags$hr(),
  33.  
  34.  
  35. checkboxGroupInput("show_vars", "Columns in diamonds to show:", names(names) )
  36. )
  37. )
  38. )
  39.  
  40. observe({
  41. if (is.null(input$file1))
  42. return(NULL)
  43. cnames <- colnames(names())
  44. updateCheckboxGroupInput(session, inputId = "show_vars", choices = cnames)
  45. })
Add Comment
Please, Sign In to add comment