reading files after defining a directory path in Shiny R
0
0
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

    })

})

Rshiny shinyapp selectdirectory • 661 views
ADD COMMENT

Login before adding your answer.

Traffic: 1633 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6