-
Notifications
You must be signed in to change notification settings - Fork 2
/
app.R
42 lines (33 loc) · 953 Bytes
/
app.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
pkgload::load_all(".")
ui <- shiny::fluidPage(
shiny::fileInput('file1', 'Select a data file'),
shiny::tableOutput('results')
)
server <- function(input, output) {
output$results <- shiny::renderTable({
inFile <- input$file1
if (is.null(inFile)) {
return()
}
lines <- readLines(inFile$datapath, n = 1000)
temp_file <- tempfile()
writeLines(lines, temp_file)
read_methods <- list(
LYS = import.LYS,
ActLumus = import.ActLumus,
read_csv = function(x) readr::read_csv(x)
)
result <- read_methods %>%
purrr::imap_dfr(function(func, name) {
tryCatch({
func(temp_file)
tibble::tibble(Method = name, Success = TRUE, Error = "")
}, error = function(e) {
tibble::tibble(Method = name, Success = FALSE, Error = as.character(e))
})
})
unlink(temp_file)
result
})
}
shiny::shinyApp(ui, server)