I want to read the data.frame file from a file and then use it to create graphs later. The problem is that when I read the data, it is part of the output object and can no longer be used. I want to use data from a csv file to create many different graphs. Here is a small example when there are two columns in the csv file, what I want to do is at the end of the functional server.
shiny::runApp(list(
ui=pageWithSidebar(
headerPanel('Simple matrixInput')
,
sidebarPanel(
fileInput('file1', 'Choose CSV File',
accept=c('text/csv', 'text/comma-separated- values,text/plain', '.csv'))
,
tags$hr(),
checkboxInput('header', 'Header', TRUE),
radioButtons('sep', 'Separator',
c(Comma=',',
Semicolon=';',
Tab='\t'),
'Comma'),
radioButtons('dec', 'Desimal seperator',
c('komma'=",",
'punktum'="."), 'komma')
)
,
mainPanel(
tableOutput(outputId = 'table.output'),
plotOutput("plot1")
))
,
server=function(input, output){
output$table.output <- renderTable({
inFile <- input$file1
if (is.null(inFile))
return(NULL)
tbl <- read.csv(inFile$datapath, header=input$header, sep=input$sep, dec = input$dec)
return(tbl)
})
}
))
source
share