it don't work now i have Error in : 'read.csv' is not an exported object from 'namespace:readr'
here you have an exemple(that not the full app) but i don't manage to provide file exemple in csv
library(shiny)
library(DT)
Define UI
ui <- shinyUI(fluidPage(
fileInput('target_upload', 'Choose file to upload',
accept = c(
'text/csv',
'text/comma-separated-values',
'.csv'
)),
radioButtons("separator","Separator: ",choices = c(";",",",":"), selected=";",inline=TRUE),
DT::dataTableOutput("sample_table")
)
)
Define server logic
server <- shinyServer(function(input, output) {
options(shiny.maxRequestSize=32*1024^2)
df_products_upload <- reactive({
inFile <- input$target_upload
if (is.null(inFile))
return(NULL)
df <- readr::read.csv(inFile$datapath, header = TRUE,sep = input$separator)
return(df)
})
output$sample_table<- DT::renderDataTable({
df <- df_products_upload()
DT::datatable(df)
})
}
)
Run the application
shinyApp(ui = ui, server = server)