From 295d0814a7e9f59d2ff2cc2fc0007bab10a7686b Mon Sep 17 00:00:00 2001 From: Schultheis Date: Mon, 25 Jun 2018 15:43:59 +0200 Subject: [PATCH 1/2] 'external_data' folder as optional second source of data files --- wilson-basic/app.R | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/wilson-basic/app.R b/wilson-basic/app.R index ab15020..4006919 100755 --- a/wilson-basic/app.R +++ b/wilson-basic/app.R @@ -498,6 +498,19 @@ server <- function(session, input, output) { # Use all .se and .clarion files specified in data/ load <- sapply(list.files(path = "data/", pattern = "\\.se|\\.clarion"), function(x){ paste0("data/", x)}) + # check for additional data + if (dir.exists("external_data/")) { + # use all .se and .clarion files specified in external_data/ + external <- sapply(list.files(path = "external_data/", pattern = "\\.se|\\.clarion"), function(x){ paste0("external_data/", x)}) + + if (length(external) > 0) { + # merge file lists + load <- c(load, external) + # sort by name + load <- load[order(names(load))] + } + } + output$fileLoader <- renderUI({ shiny::req(input$data_origin) From c23d7d6aa2fb94a2349c4ec60f388e6b66bda649 Mon Sep 17 00:00:00 2001 From: Schultheis Date: Tue, 26 Jun 2018 09:15:12 +0200 Subject: [PATCH 2/2] in case of duplicated names favor external data --- wilson-basic/app.R | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wilson-basic/app.R b/wilson-basic/app.R index 4006919..b918b74 100755 --- a/wilson-basic/app.R +++ b/wilson-basic/app.R @@ -504,6 +504,8 @@ server <- function(session, input, output) { external <- sapply(list.files(path = "external_data/", pattern = "\\.se|\\.clarion"), function(x){ paste0("external_data/", x)}) if (length(external) > 0) { + # omit duplicated names from load + load <- load[setdiff(names(load), names(external))] # merge file lists load <- c(load, external) # sort by name