#' paths UI Function
#'
#' @description A shiny Module.
#'
#' @param id,input,output,session Internal parameters for {shiny}.
#'
#' @noRd
#'
#' @importFrom shiny NS tagList
mod_paths_ui <- function(id){
ns <- NS(id)
tagList(
h2("Speicherort"),
textInput(
inputId = ns("data_dir"),
label = "Datenordner",
value = "~/Nextcloud/OekoFor/04 R Projekte/IDF",
placeholder = "Pfad zu Ordner",
width = "100%"
),
br(),
actionButton(inputId = ns("list_files"), label = "Pfad anwenden", icon = icon("folder-open"))
)
}
#' paths Server Functions
#'
#' @noRd
mod_paths_server <- function(id){
moduleServer( id, function(input, output, session){
ns <- session$ns
paths <- reactiveValues()
# Create Paths and Partitions
observeEvent(input$list_files, {
paths$all_tracks <-
file.path(input$data_dir, "data", "alltracks_for_idf_curtailment_investigator") %>%
path.expand() %>%
normalizePath()
paths$curtailments <-
file.path(input$data_dir, "data", "curtailments_w_alltracks_track_id") %>%
path.expand() %>%
normalizePath()
paths$evaluations <-
file.path(input$data_dir, "data", "idf_curtailments_investigator", "evaluations") %>%
path.expand() %>%
normalizePath()
paths$picture_dir <-
file.path(input$data_dir, "pictures") %>%
path.expand() %>%
normalizePath()
idf_coords_path <- file.path(input$data_dir, "data", "idf_setup_coordinates.rda") %>%
path.expand() %>%
normalizePath()
load(coords_path, envir = .GlobalEnv)
curtailed_turbines_path <- file.path(input$data_dir, "data", "idf_setup_coordinates.rda") %>%
path.expand() %>%
normalizePath()
load(curtailed_turbines_path, envir = .GlobalEnv)
curtailment_radii_path <- file.path(input$data_dir, "data", "idf_setup_coordinates.rda") %>%
path.expand() %>%
normalizePath()
load(curtailment_radii_path, envir = .GlobalEnv)
})
return(paths)
})
}
## To be copied in the UI
# mod_paths_ui("paths_ui_1")
## To be copied in the server
# mod_paths_server("paths_ui_1")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.