Advertisement
Guest User

Untitled

a guest
Jul 19th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. ```{r UI inputs}
  2. wellPanel(
  3. fileInput("dataset", label = "Select a .csv File to upload",
  4. accept=c("text/csv",
  5. "text/comma-separated-values,text/plain",
  6. ".csv")),
  7.  
  8. actionButton(inputId = "loadbutton", label = "Load Data")
  9. )
  10.  
  11. dataTableOutput("df")
  12.  
  13. ```
  14.  
  15. ```{r Server Functions}
  16. load_table <- eventReactive(input$loadbutton, {
  17. # input$file1 will be NULL initially. After the user selects
  18. # and uploads a file, it will be a data frame with 'name',
  19. # 'size', 'type', and 'datapath' columns. The 'datapath'
  20. # column will contain the local filenames where the data can
  21. # be found.
  22. inFile <- input$dataset
  23.  
  24. if (is.null(inFile)){
  25. return(NULL)}
  26. else {
  27. read.csv(inFile$datapath)}
  28. })
  29.  
  30. output$df <- renderDataTable({
  31. load_table()
  32. })
  33. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement