Entering edit mode
16 months ago
SHN
▴
40
Hi All,
I am making an R, plotting my results and I want the R shiny app to be used in another computer. I would like to make a button to ask the user to select the path to a directory on their own device, and then use the path to upload the data files.
I have used the below in my server but I can't find a way to use the path for reading my files. Any help would be appreciated
function(input, output, session) {
# test stop
session$onSessionEnded(function() {
stopApp()
})
# define folder path to load the data by the user
sysname = Sys.info()
roots <- c(home = '~')
rv <- reactiveValues(directory_path = "Nothing is Selected")
shinyDirChoose(input, "directory", roots = roots, filetypes = NULL)
observeEvent(input$directory, {
rv$directory_path <- parseDirPath(roots, input$directory)
})
# set a bar below your path directory selection buttom
output$selected_directory <- renderText({
rv$directory_path
})
})