Created
July 8, 2019 19:53
-
-
Save trestletech/94150754d343857e3baa28ec2076fbf1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# 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