Skip to content

Commit

Permalink
reading of data now in Observe block
Browse files Browse the repository at this point in the history
  • Loading branch information
Konrad1991 committed Aug 1, 2024
1 parent e5d27ea commit bc44c38
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tsf/R/server.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,22 @@ server <- function(input, output, session) {
# data import
# ============================================================================
data <- reactiveValues(df = NULL)
output$df <- renderDT({

observeEvent(input$upload, {
req(input$upload)
df <- importData(input$upload$datapath)
if (is.data.frame(df)) {
if (ncol(df) != 2) {
showNotification("Data has wrong dimensions two columns were expected")
showNotification("Data has wrong dimensions, two columns were expected")
} else if (nrow(df) == 0) {
showNotification("Data has 0 rows.")
} else {
names(df) <- c("var", "signal")
data$df <- df
output$df <- renderDT(data$df)
}
} else {
showNotification("File can not be used. Upload into R failed!", duration = 0)
showNotification("File cannot be used. Upload into R failed!", duration = 0)
}
})

Expand Down Expand Up @@ -81,4 +83,3 @@ server <- function(input, output, session) {
GDA_com_sense$destroy()
})
}

0 comments on commit bc44c38

Please sign in to comment.