Suddenly fileInput doesn't import file

The fileInput opens a window to browser for a file, and selects it, but doesn't load the file. The file namne doesn't show in the fileInput field. I am using a shiny dashboard

The code was working, and I updated my system software.,,.not sure if that did it. I also added the two plot panels on the first tabItem. fileInput just quit working, The tabInput syntax looks fine. I'm getting no errors, Help.

# Plex dashboard

library(shiny)
library(shinydashboard)
options(shiny.maxRequestSize=30*1024^2) 
tz="GMT"

ui <- dashboardPage(
  
  dashboardHeader(title = "Plexogram"),
  
  ## Sidebar content
  dashboardSidebar(
    sidebarMenu(
      menuItem("Configure", tabName = "config", icon = icon("tachometer-alt"),
         menuSubItem("Input parameters", tabName = "inputP", icon = icon("database")),
         menuSubItem("View input data", tabName = "inputD", icon = icon("database")),
         menuSubItem("View binned data", tabName = "inputB", icon = icon("database"))),

      menuItem("Results", tabName = "results", icon = icon("digital-tachograph "),
        menuSubItem("Results Plot", tabName = "resultsP", icon = icon("chart-line")),
        menuSubItem("Results Table", tabName = "resultsT", icon = icon("table"))),

      menuItem("About Plexogram", tabName = "about", icon = icon("info")),
      menuItem("Documentation", tabName = "document", icon = icon("readme"))
    )
  ),
  
  ## Body content
  dashboardBody(
    tabItems(
      # First tab content
      tabItem(tabName = "inputP",
              h4("Tabs hold parameters for configuring Plex."),
              fluidRow( 
                tabBox(title = "Plex Parameters", id = "paramBox", height = "250px", width=12, side="right",
                  tabPanel("File Parameters", value="paramFile1",
                    p(" "),
                    p("Select the data file, and basic file characteristics."),
                    box(fileInput(inputId="fileName", label="Choose CSV or TXT file", 
                                         accept = c("text/csv", "text/comma-separated-values,text/plain", ".csv"), 
                                         width = "380px", buttonLabel = "Browse...", placeholder = "No file selected"),width=5),
                    box(radioButtons(inputId="header", label="Header in data file?", 
                          choices=c(TRUE, FALSE), 
                          selected = NULL,inline = FALSE, width = '80px'),width=2),
                    box(numericInput(inputId="Skip", label="Skip rows before data?", value=0, min = 0, width = '80px'),width=2),
                    box(textInput(inputId="timeFormat", label="Time format (R syntax)", value = "%d/%m/%Y %H:%M:%S", width = '200px'),width=3)    # , placeholder = "%Y%m%d%MM%HH"
                  ),     # close tabPanel
                  tabPanel(title="More File Parameters", value="paramFile2",
                    p(" "),
                    p("Select additional file characteristics."),
                    box(numericInput(inputId="timeCol", label="Column #:  Time", value=1, min = 0, width = '80px'),width=2),
                    box(numericInput(inputId="valCol", label="Column #: data (averagable)", value=8, min = 0, width = '80px'),width=2),
                    box(numericInput(inputId="sumCol", label="Column #: data (summable)", value=0, min = 0, width = '80px'),width=2),
                    box(textInput(inputId="title", label="Title this run:", value = "", width = '440px', placeholder = "To distinguish this run from others"),width=6)
                  ),     # close tabPanel
                  tabPanel(title="Binning",value="paramBin",
                    p(" "),
                    p("Will you bin the data from the input file before analysis?  Set binning parameters."),
                    box(radioButtons(inputId="bin", label="Bin data?", 
                                     choices=c("True" = TRUE,
                                               "False" = FALSE), selected = NULL,inline = FALSE, width = '80px'),width=2),
                    box(numericInput(inputId="Interval", label="Resulting bin size (hrs)", value=3, min = 0, width = '80px'),width=2),
                    box(numericInput(inputId="Midpoint", label="Midpoint (hrs past start of bin)", value=.5, min=0,max=1, width = '200px'),width=2),
                    #box(dateRangeInput(dateRange, "Date range:")
                    box(textInput(inputId="start", label="Binning start time", value = "25/08/2017 06:00:42", width = '200px', placeholder = "put timeFormat here"),width=3),
                    box(textInput(inputId="end", label="Binning end time", value = "01/10/2017 23:59:53", width = '200px', placeholder = verbatimTextOutput("input$timeFormat")),width=3)
                  ),      # close tabPanel
                  tabPanel("Plex",value="paramPlex",
                     p(" "),
                     p("Reference time, number of folds, and number of classes for the plexogram and ANOVA."),
                     box(actionButton(inputId="Go", label="Run Plex"),width=3),
                     box(numericInput(inputId="nClasses", label="# of classes in fold:", value=0, min = 0, width = '80px'),width=2),
                     box(numericInput(inputId="foldLen", label="Length of each fold:", value=.5, min=0,max=1, width = '200px'),width=2),
                     box(textInput(inputId="RefTime", label="Reference date/time", value = "", width = '200px', placeholder = "put timeFormat here"),width=3)
                  )      # close tabPanel
                )       # close tabBox
              ),    #  close fluidrow
              fluidRow( 
                tabBox(title = "Plex Plots", id = "plotBox", height = "500px", width=12, side="right",
                       tabPanel(title="Data Plot", value="plotData",
                                p(" "),
                                p("This is a plot of the data file, or binned data, if binning was used."),
                                box(plotOutput("resultsP"),width=12)
                       ),     # close tabPanel
                       tabPanel(title="Plexogram", value="plotPlex",
                                p(" "),
                                p("This is a plot of the data folded over into a Plexogram."),
                                box(plotOutput("resultsP"),width=12)
                          )    # close tabPanel    
                       )     # close tabBox
              )    #  close fluidrow
      ),
      # Second tab content
      tabItem(tabName = "inputD",
              h3("Data from input file"),
              tableOutput("data")
              
      ),
      # Third tab content
      tabItem(tabName = "inputB",
              h3("Data from input file, after binning"),
              tableOutput("binData")
              
      ),
      # fourth tab content
      tabItem(tabName = "resultsP",
              h3("Results plot content"),
                 plotOutput("resultsP")
      ),
      # Fifth tab content
      tabItem(tabName = "resultsT",
              h3("Results table content")
      ),
      # Sixth tab content
      tabItem(tabName = "about",
              h3("About the Plex -- uses and overview")
      ),
      # Seventh tab content
      tabItem(tabName = "document",
              h2("Details of using Plex;  parameter definitions")
      )
      )  #  end of tabItem-s
    )  #  end of dashboardBody
)  #  end if UI 

server <- function(input, output) {      
  # 
  pMatrix<-reactive({
        # input$data1 will be NULL initially. After the user selects and uploads a file, it will be a data frame with 'name',
        # 'size', 'type', and 'datapath' columns. The 'datapath' column will contain the local filenames where the data can
        # be found.

        #req(input$fileName)
        validate(need(!is.na(input$timeFormat), "Error: Please provide the time format in the File Parameters tab."),
                 need(!is.na(input$fileName), "Error: Please provide the file name in the File Parameters tab."),
                 need(!is.na(input$timeCol), "Error: Please provide the time column in the More File Parameters tab."),
                 need(!is.na(input$valCol), "Error: Please provide the data column in the More File Parameters tab."))

        inFile <- input$fileName
  
        # if (is.null(inFile))
        #   return(NULL)
        pFileRead(header=as.logical(input$header), Skip=input$Skip, TimeCol=input$timeCol, Y=input$valCol, fileName=inFile$datapath,functionName=input$title)
  })  

  output$data <-renderTable({pMatrix()
    }, striped = TRUE, hover = TRUE, bordered = TRUE, rownames=TRUE)


    output$binData <- renderTable({bMatrix()
    }, striped = TRUE, hover = TRUE, bordered = TRUE, rownames=TRUE)
      
    bMatrix<-reactive({
    # input$data1 will be NULL initially. After the user selects and uploads a file, it will be a data frame with 'name',
    # 'size', 'type', and 'datapath' columns. The 'datapath' column will contain the local filenames where the data can
    # be found.
    validate(need(!is.na(input$Interval), "Error: Please provide the Interval in the Binning tab."),
             need(!is.na(input$Midpoint), "Error: Please provide the Midpoint in the Binning tab."),
             need(!is.na(input$start), "Error: Please provide the binning starting time in the Binning tab."),
             need(!is.na(input$end), "Error: Please provide the binning ending time in the Binning tab."))
    inFile <- input$fileName
    
    if (as.logical(input$bin)){    #invalid to from by #42
      #bMatrix<-
      CatBinNEq(x=pMatrix(),tsCol=input$timeCol, timeFormat=input$timeFormat, valCols=input$valCol, NEq=list(Interval=input$Interval,Midpoint=input$Midpoint,start=input$start,end=input$end,title=input$title),tz=tz)
      # lum, tz, 
      #bMatrix
    } else
    {
      NULL
    }
    })          #, striped = TRUE, hover = TRUE, bordered = TRUE, rownames=TRUE)

    # output$ncount_2 <- renderPrint({
    #   hdr <- input$header
    #   paste(hdr,"100",sep="_")
    #})
    output$resultsP <- renderPlot({
      input$Go
      validate(need(!is.na(input$nClasses), "Error: Please provide the number of Classes in the Plex tab."),
               need(!is.na(input$foldLen), "Error: Please provide the length for folding the Plexogram in the Plex tab."),
               need(!is.na(input$RefTime), "Error: Please provide the reference time in the Plex tab."))
      if (as.logical(input$bin)){ 
        dMatrix<-cbind(bMatrix()[[1]],bMatrix()[[2]])
      } else {
        #  how to show on the output panel that no binning was done?
        dMatrix<-cbind(pMatrix()[[input$timeCol]],pMatrix()[[input$valCol]])
      }
      CatPlexigram<-CatPlex(dMatrix, Plex=list(plex=TRUE, nClasses=input$nClasses, foldLen=input$foldLen, RefTime=input$RefTime), title=input$title, timeFormat=input$timeFormat, tz=tz, Debug=FALSE, fileName=input$fileName,shinyRun=TRUE)
      #plot(CatPlexigram$data)
      #  aovData x&y;   p1Data  x&y;     p2Data   x&y
      opar = par()
      # par(font.axis = 2)
      # par(font.lab = 2)
      #npar(family = "AvantGarde")
      plot(as.numeric(CatPlexigram$p1Data[,1]),as.numeric(CatPlexigram$p1Data[,2]),xlab="Time (hours from Reference Time)",ylab=input$title,type="l",bty='n')
      #remove read only list components 
      opar$cin<-NULL
      opar$cra<-NULL
      opar$csi<-NULL
      opar$cxy<-NULL
      opar$din<-NULL
      opar$page<-NULL
      par(opar)
      })
  
  #CatBinNEq, list(x=myData1,tsCol=TimeCol, timeFormat=timeFormat, valCols=input$valCols, NEq=list(Interval=NEq$Interval,Midpoint=NEq$Midpoint,start=NEq$start,end=NEq$end,title=NEq$title),tz=tz))
}

shinyApp(ui = ui, server = server)

When I take out the second fluidRow in tabItem tabName="inputP" it works!! Is this a bug, or why does it do that?

Within that 2nd fluidRow I had to take out the second instance of the plotOutput!!

  tabItem(tabName = "resultsP",
          h3("Results plot content")
          #  having two isn't allowed
          #   plotOutput("resultsP") 

It is outputting the same plot. Why should this be a problem???

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.