Skip to content

Instantly share code, notes, and snippets.

@trestletech
Created July 8, 2019 19:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trestletech/94150754d343857e3baa28ec2076fbf1 to your computer and use it in GitHub Desktop.
Save trestletech/94150754d343857e3baa28ec2076fbf1 to your computer and use it in GitHub Desktop.
#
# 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