Skip to content

Instantly share code, notes, and snippets.

@trestletech trestletech/app.R
Created Jul 8, 2019

Embed
What would you like to do?
#
# This is a Shiny web application. You can run the application by clicking
# the 'Run App' button above.
#
# Find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com/
#
library(shiny)
# Define UI for application that draws a histogram
ui <- fluidPage(
# To rename data
textInput("data_name", "", placeholder = "Example : 20190625_Data_Name"),
# To download file
fileInput("data_exp","", multiple = TRUE),
#To launch process
actionButton("import", "Download")
)
library(shinyWidgets)
# Define server logic required to draw a histogram
server <- function(input, output, session) {
UploadData <- reactive({
file1 <- input$data_exp
if(is.null(file1)){return()}
return(read.table(file=file1$datapath))
})
observeEvent(input$import, {
if (is.null(input$data_name) || input$data_name == "") {
sendSweetAlert(
session = session,
title = "Error...",
text = "Nom des données vide",
type = "error"
)
} else {
data <- UploadData()
print(data)
sendSweetAlert(
session = session,
title = "Done !",
text = "Vos données ont bien été traitées",
type = "success"
)
}
})
}
# Run the application
shinyApp(ui = ui, server = server)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.