Publish to shiny upload file, there will be an error, how to solve?
this is code
library(shiny)
shinyUI(fluidPage(
titlePanel("File Input"),
sidebarLayout(
sidebarPanel(
fileInput("file","Upload the file"),
helpText("Default max. file size is 5MB"),
tags$hr(),
h5(helpText("Select the read.table parameters below")),
checkboxInput(inputId = 'header',label = 'Header', value = FALSE),
br(),
radioButtons(inputId = 'sep' , label = 'Separator', choices = c(Comma=',',Semicolon=';',Tab='\t'),selected = ',')
),
mainPanel(
uiOutput("tb")
)
)
))
library(shiny)
#options(shiny.maxPequestSize = 9*1024^2)
shinyServer(
function(input, output) {
data <-reactive({
file1 <- input$file
if(is.null(file1)){return()}
read.table(file =file1$datapath, sep=input$sep, header = input$header)
})
output$filedf <- renderTable({
if(is.null(data())){return()}
input$file
})
output$sum <- renderTable({
if(is.null(data())){return()}
summary(data())
})
output$table <- renderTable({
if(is.null(data())){return()}
data()
})
output$tb <- renderUI({
if(is.null(data()))
h5("Powered by", tags$img(src='S_8537261741698.png',heigth=100, width=120))
else
tabsetPanel(tabPanel("About file", tableOutput("filedf")),tabPanel("Data",tableOutput("table")),tabPanel("Summary",tableOutput("sum")))
})
})