Off topic:Inconsistency in shinyFiles output.
0
0
Entering edit mode
4.0 years ago

Hi there.

My objective is to record a folder path that contains BED files. The user is required to browse to the folder and choose any BED file. On doing that the absolute path to that folder gets recorded. I have a working code below.

 ui <- shinyUI(bootstrapPage(
shinyFilesButton('files','Folder select','Please select a BED file', FALSE),
                            verbatimTextOutput('filepaths')))


server <- shinyServer(function(input, output) {
  roots = getVolumes()
  shinyFileChoose(input,'files', roots=roots, filetypes=c('','bed'))
  output$filepaths <- renderText({paste0(dirname(parseFilePaths(roots, input$files)$datapath), "/")})})

runApp(list(ui=ui,server=server))

Although, when I try to incorporate it into my actual script, an error is returned.

Warning: Error in list.files: invalid 'path' argument

The excerpts from the ui.R and server.R are as under, respectively.

ui.R

shinyUI(fluidPage(theme = shinytheme("united"),
...
sidebarLayout("", fluid = TRUE,
                                sidebarPanel(
                                  shinyFilesButton('files','Folder select','Please select a BED file', FALSE),
                                  verbatimTextOutput('filepaths', placeholder = TRUE),
...
))

server.R

    shinyServer(function(input, output, session){
...
dataFolder <- NULL
    ## Validating path and confirming upload

      roots <- getVolumes()
      shinyFileChoose(input,'files', roots=roots, filetypes=c('','bed'))  
      dataFolder <<- reactive({paste0(dirname(parseFilePaths(roots, input$files)$datapath), "/")}) ## Store folder location
      output$filepaths <- renderText({dataFolder})
...
    })

Any suggestions? Thanks.

shinyFiles shinyApp server.R • 598 views
ADD COMMENT
This thread is not open. No new answers may be added
Traffic: 2905 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