Created
July 18, 2022 05:44
-
-
Save dian161/b917904aa938ef8b1678f828d040aec3 to your computer and use it in GitHub Desktop.
Shiny App Demo with 2 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(shiny) | |
server<-(function(input, output){ | |
output$tableContents<-renderTable({ | |
inFile<-input$fileNameWithPath | |
if (is.null(inFile)) | |
return(NULL) | |
read.csv(inFile$datapath, header = input$inputHeader, sep=input$inputSep, quote = input$inputQuote) | |
}) | |
}) | |
shinyApp(ui, server) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(shiny) | |
ui<-(fluidPage( | |
titlePanel("Uploading Files"), | |
sidebarLayout( | |
sidebarPanel( | |
fileInput('fileNameWidthPath','Choose CSV File', accept = c('text/csv','text/comma-separated-values,text/plain','.csv')), | |
tags$hr(), | |
tags$h1("Hello:"), | |
checkboxInput('inputHeader', 'Header', T), | |
tags$hr(), | |
radioButtons('inputSep','Separator', | |
c(Comma=',', Semicolon=';', Tab='\t'),','), | |
radioButtons('inputQuote','Quote', | |
c(None=',', 'Double Quote'='"', 'Single Quote'="'"), '"') | |
), | |
mainPanel( | |
tableOutput('tableContents') | |
) | |
) | |
)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment