Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ```{r UI inputs}
- wellPanel(
- fileInput("dataset", label = "Select a .csv File to upload",
- accept=c("text/csv",
- "text/comma-separated-values,text/plain",
- ".csv")),
- actionButton(inputId = "loadbutton", label = "Load Data")
- )
- dataTableOutput("df")
- ```
- ```{r Server Functions}
- load_table <- eventReactive(input$loadbutton, {
- # input$file1 will be NULL initially. After the user selects
- # and uploads a file, it will be a data frame with 'name',
- # 'size', 'type', and 'datapath' columns. The 'datapath'
- # column will contain the local filenames where the data can
- # be found.
- inFile <- input$dataset
- if (is.null(inFile)){
- return(NULL)}
- else {
- read.csv(inFile$datapath)}
- })
- output$df <- renderDataTable({
- load_table()
- })
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement