title: Variable not loaded before the file is loaded in R shiny app
body: <p>I am trying to create a Shiny App where the user loads the data at the time of execution. When I run my Shiny App, below is the screen that opens. On the right I want it to display nothing before we load the data but as you see a warning is displayed at the end. </p>
  
  <p>I have tried putting inherit.aes = False since ggplot is using the execution_date column from the data but this still doesn't work. </p>
  
  <p><a href="https://i.stack.imgur.com/IFc6Q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IFc6Q.png" alt="Initial warning"></a></p>
  
  <p>Below is my code:</p>
  
  <pre><code>library(readxl)
  library(shiny)
  
  #install.packages("shinyWidgets")
  library(shinyWidgets)
  df &lt;- read_xlsx("Results.xlsx", sheet =  1)
  lst.measures &lt;- as.list(unique(df$DQ_Check))
  
  # Define UI for application that draws a histogram
  ui &lt;- fluidPage(
  
    # Application title
    titlePanel("Data Quality Result Monitoring Dashboard"),
  
    # Sidebar with a slider input for number of bins 
    sidebarLayout(
      sidebarPanel(
        fileInput('file1', 'Choose xlsx file',
                  accept = c(".xlsx")
        ),
  
  
      radioButtons("disp", "Display",
                   choices = c(Head = "head",
                               All = "all"),
                   selected = "head"),
  
    pickerInput(
      inputId = "myPicker", 
      label = "Which DQ Checks would you like to see in more detail?", 
      choices = lst.measures, 
      multiple = TRUE,
      options = pickerOptions(
        actionsBox = TRUE, 
        size = 10,
        selectedTextFormat = 'count &gt; 3'
      )
    )  
    ),
    # Show a plot of the generated distribution
    mainPanel(
      h4("Chart"),
      plotOutput("linechart"),
  
      h4("Observations"),
      tableOutput("contents")
    )
  )    
  )
  
  # Define server logic required to draw a histogram'
  library(ggplot2)
  library(tidyverse)
  server &lt;- function(input, output) {
  
    df &lt;- reactive({
  
      inFile &lt;- input$file1
  
      if (is.null(inFile))
        return(NULL)
  
      df &lt;- read_xlsx(inFile$datapath, sheet =  1)
  
      df
  
    })
  
    output$linechart &lt;- renderPlot({
  
      ggplot(df(),aes(x= Execution_Date,y=Fail_Count, group(Execution_Date)),inherit.aes = FALSE)+geom_bar(stat = "identity")
  
    })
  
    output$contents &lt;- renderTable({
  
      # input$file1 will be NULL initially. After the user selects
      # and uploads a file, head of that data file by default,
      # or all rows if selected, will be shown.
  
      dataset &lt;- df()
      if(input$disp == "head") {
        return(head(dataset))
      }
      else {
        return(dataset)
      }
  
    })
  
  }
  
  # Run the application 
  shinyApp(ui = ui, server = server)
  </code></pre>