title: How do I get my data to render correctly?
body: <p>Could somebody review my code to make sure its all correct? I have read the data in and looks all fine, just when I go to run the shiny, the chart appears, but no data. I have hidden some functionality from the program with the # as I couldn't get additional variables to select correctly. I have included some data for the weather_files, weather_years and weather data.</p>
  <p><strong>weather_files</strong></p>
  <pre><code>structure(list(Town = structure(c(2L, 4L, 2L, 1L, 1L, 1L, 1L, 
  4L, 1L, 4L, 5L, 1L, 2L, 4L, 2L, 5L, 5L, 1L, 3L, 4L, 3L, 3L, 5L, 
  5L, 5L), .Label = c(&quot;braemar&quot;, &quot;dunstaffnage&quot;, &quot;nairn&quot;, &quot;stornoway&quot;, 
  &quot;tiree&quot;), class = c(&quot;ordered&quot;, &quot;factor&quot;)), year = structure(c(132L, 
  37L, 128L, 100L, 137L, 147L, 143L, 22L, 103L, 89L, 96L, 138L, 
  109L, 87L, 142L, 109L, 61L, 138L, 136L, 75L, 112L, 92L, 118L, 
  100L, 66L), .Label = c(&quot;1873&quot;, &quot;1874&quot;, &quot;1875&quot;, &quot;1876&quot;, &quot;1877&quot;, 
  &quot;1878&quot;, &quot;1879&quot;, &quot;1880&quot;, &quot;1881&quot;, &quot;1882&quot;, &quot;1883&quot;, &quot;1884&quot;, &quot;1885&quot;, 
  &quot;1886&quot;, &quot;1887&quot;, &quot;1888&quot;, &quot;1889&quot;, &quot;1890&quot;, &quot;1891&quot;, &quot;1892&quot;, &quot;1893&quot;, 
  &quot;1894&quot;, &quot;1895&quot;, &quot;1896&quot;, &quot;1897&quot;, &quot;1898&quot;, &quot;1899&quot;, &quot;1900&quot;, &quot;1901&quot;, 
  &quot;1902&quot;, &quot;1903&quot;, &quot;1904&quot;, &quot;1905&quot;, &quot;1906&quot;, &quot;1907&quot;, &quot;1908&quot;, &quot;1909&quot;, 
  &quot;1910&quot;, &quot;1911&quot;, &quot;1912&quot;, &quot;1913&quot;, &quot;1914&quot;, &quot;1915&quot;, &quot;1916&quot;, &quot;1917&quot;, 
  &quot;1918&quot;, &quot;1919&quot;, &quot;1920&quot;, &quot;1921&quot;, &quot;1922&quot;, &quot;1923&quot;, &quot;1924&quot;, &quot;1925&quot;, 
  &quot;1926&quot;, &quot;1927&quot;, &quot;1928&quot;, &quot;1929&quot;, &quot;1930&quot;, &quot;1931&quot;, &quot;1932&quot;, &quot;1933&quot;, 
  &quot;1934&quot;, &quot;1935&quot;, &quot;1936&quot;, &quot;1937&quot;, &quot;1938&quot;, &quot;1939&quot;, &quot;1940&quot;, &quot;1941&quot;, 
  &quot;1942&quot;, &quot;1943&quot;, &quot;1944&quot;, &quot;1945&quot;, &quot;1946&quot;, &quot;1947&quot;, &quot;1948&quot;, &quot;1949&quot;, 
  &quot;1950&quot;, &quot;1951&quot;, &quot;1952&quot;, &quot;1953&quot;, &quot;1954&quot;, &quot;1955&quot;, &quot;1956&quot;, &quot;1957&quot;, 
  &quot;1958&quot;, &quot;1959&quot;, &quot;1960&quot;, &quot;1961&quot;, &quot;1962&quot;, &quot;1963&quot;, &quot;1964&quot;, &quot;1965&quot;, 
  &quot;1966&quot;, &quot;1967&quot;, &quot;1968&quot;, &quot;1969&quot;, &quot;1970&quot;, &quot;1971&quot;, &quot;1972&quot;, &quot;1973&quot;, 
  &quot;1974&quot;, &quot;1975&quot;, &quot;1976&quot;, &quot;1977&quot;, &quot;1978&quot;, &quot;1979&quot;, &quot;1980&quot;, &quot;1981&quot;, 
  &quot;1982&quot;, &quot;1983&quot;, &quot;1984&quot;, &quot;1985&quot;, &quot;1986&quot;, &quot;1987&quot;, &quot;1988&quot;, &quot;1989&quot;, 
  &quot;1990&quot;, &quot;1991&quot;, &quot;1992&quot;, &quot;1993&quot;, &quot;1994&quot;, &quot;1995&quot;, &quot;1996&quot;, &quot;1997&quot;, 
  &quot;1998&quot;, &quot;1999&quot;, &quot;2000&quot;, &quot;2001&quot;, &quot;2002&quot;, &quot;2003&quot;, &quot;2004&quot;, &quot;2005&quot;, 
  &quot;2006&quot;, &quot;2007&quot;, &quot;2008&quot;, &quot;2009&quot;, &quot;2010&quot;, &quot;2011&quot;, &quot;2012&quot;, &quot;2013&quot;, 
  &quot;2014&quot;, &quot;2015&quot;, &quot;2016&quot;, &quot;2017&quot;, &quot;2018&quot;, &quot;2019&quot;, &quot;2020&quot;), class = 
  &quot;factor&quot;), 
  month_year = structure(c(10L, 7L, 2L, 7L, 6L, 11L, 8L, 3L, 
  4L, 3L, 12L, 6L, 1L, 7L, 3L, 9L, 4L, 4L, 8L, 4L, 10L, 3L, 
  4L, 10L, 8L), .Label = c(&quot;April&quot;, &quot;August&quot;, &quot;December&quot;, &quot;February&quot;, 
  &quot;January&quot;, &quot;July&quot;, &quot;June&quot;, &quot;March&quot;, &quot;May&quot;, &quot;November&quot;, &quot;October&quot;, 
  &quot;September&quot;), class = &quot;factor&quot;), month = c(11, 6, 8, 6, 7, 
  10, 3, 12, 2, 12, 9, 7, 4, 6, 12, 5, 2, 2, 3, 2, 11, 12, 
  2, 11, 3), `Maximum Temp` = c(104, 134, 191, 132, 178, 98, 
  76, 8, 6, 58, 151, 17, 121, 158, 81, 132, 71, 23, 82, 29, 
  93, 59, 81, 93, 101), `Minimum Temp` = c(63, 8, 115, 5, 82, 
  2, 1, 26, 22, 11, 101, 89, 36, 87, 28, 75, 31, 58, 16, 21, 
  42, 1, 31, 41, 66), `Air Frost Days` = c(2, 0, 0, 0, 0, 12, 
  13, 4, 17, 19, 0, 0, 2, 0, 3, 0, 2, 24, 6, 17, 2, 12, 2, 
  1, 0), `Rainfall (mm)` = c(1074, 564, 107, 636, 884, 642, 
  684, 1789, 356, 104, 1281, 93, 247, 744, 2712, 78, 904, 156, 
  416, 111, 841, 466, 2463, 1104, 1091), Sunshine = c(NA, NA, 
  1538, 1431, NA, NA, NA, NA, 801, 263, 1375, NA, NA, 206, 
  NA, 1993, 723, NA, 1068, 863, 339, NA, 459, 456, 628)), row.names = 
  c(NA, 
  -25L), class = c(&quot;tbl_df&quot;, &quot;tbl&quot;, &quot;data.frame&quot;))
  </code></pre>
  <p>Ones that read it, the input data for the Shiny is this:</p>
  <pre><code>weather_data &lt;- levels(weather_files$Town)
  Weather_years &lt;- levels(weather_files$year)
  Weather_month &lt;- levels(weather_files$month_year)
  </code></pre>
  <p>Essentially what im trying to do is select the Town, then the Year and a variable (columns 5:9 - however that wont work at all), so i chose Sunshine column instead for now. Then plot the month_year column on the X axis against the Sunshine column on Y axis, colour/ fill by year as id hope you can select multiple years. Hope that makes what im doing clear.
  <strong>Thanks in advance.</strong></p>
  <pre><code>ui &lt;- fluidPage(
  
   titlePanel(&quot;Met Office Weather&quot;),
  
  
  sidebarLayout(
  sidebarPanel(
    selectInput(label = (&quot;Select Data Set&quot;),
                inputId = &quot;Town&quot;,
                choices = weather_data,
                multiple = TRUE),
    
    selectInput(label = &quot;Select Year&quot;,              
                inputId = &quot;year&quot;,
                choices = Weather_years,
                multiple = TRUE),
    
    #selectInput(inputId = &quot;selection&quot;,
        #             label=&quot;Select Variable&quot;,
         #             choices = c(&quot;Sunshine&quot;),
          #           multiple = FALSE),
    
    actionButton(inputId = &quot;go&quot;, label = &quot;Plot Data&quot;)
  ),
  
  # Show the generated plot
  mainPanel(
    tabsetPanel(
      tabPanel(&quot;scatterplot&quot;, plotOutput(&quot;scatter&quot;)),
      tabPanel(&quot;Barplot&quot;, plotOutput(&quot;barplot&quot;)),
      tabPanel(&quot;The Data&quot;, dataTableOutput(&quot;table&quot;))
     )
    )
   )
  )
  
  
  server &lt;- function(input, output) {
  
  select_weatherdf &lt;- reactive({
  # gather info from user but only when asked
  pick_town &lt;- isolate(input$Town)
  select_year &lt;- isolate(input$year)
  #choose_variable &lt;- isolate(input$Sunshine)
  
  # listen to go button
  input$go
  
  # select the correct town and year looking at sunshine variable only
  weather_to_plot &lt;- weather_files %&gt;% filter(Town %in% pick_town, year %in% select_year)
  #weather_to_plot &lt;- weather_to_plot %&gt;% select(&quot;Town&quot;, &quot;year&quot;, &quot;month_year&quot;, &quot;Sunshine&quot;)
  
  return(weather_to_plot)
  
  })
  
   output$scatter &lt;- renderPlot({
  
   data_to_plot &lt;- select_weatherdf()
   ggplot(data_to_plot, aes(x = month_year, y = Sunshine , fill = year)) +
    geom_point(size = 2.5) +
    scale_x_discrete(limits = month.name)
  
  
  
   })
  
    output$barplot &lt;- renderPlot({
  
  data_to_plot &lt;- select_weatherdf()
  ggplot(data_to_plot, aes(x = month_year, fill = year)) + 
    geom_bar() +
    scale_x_discrete(limits = month.name)
   })
  
  
     output$table &lt;- renderDataTable({
  
  data_to_plot &lt;- select_weatherdf()
  
  })
  }
  
  # Run the application 
  shinyApp(ui = ui, server = server)
  </code></pre>