Shiny R: Implement Slider Input
<p>I have this dataset <a href="https://ufile.io/0f835" rel="nofollow noreferrer">here</a> and I would like to create a simple Slider Input where the respective average Temperature of the country will change by changing the year. So far I have written this. I want to project the average Temperature of Canada throughout the years from 1743 till 2013. How should I proceed in making this happen?</p>

<p><strong>ui.R</strong> </p>

<pre><code>fluidPage(
  verticalLayout(
    titlePanel("Russian Average Temperature"),
    plotOutput("plot1"),
    wellPanel(
      sliderInput("Year", "Timeline", 1743, 2013,
                  value = 0, step = 1)
    )
  )
)
</code></pre>

<p><strong>server.R</strong></p>

<pre><code>library(shiny)
library(dplyr)
library(tidyr)
library(ggplot2)

data &lt;- read.csv("..\\GlobalLandTemperatures\\GlobalLandTemperaturesByState.csv",
                 fileEncoding = "UTF-8")

function(input, output) {

  data  %&gt;%
    filter(Country=="Canada")  %&gt;%
    separate(col = dt, into = c("Year", "Month", "Day"), convert = TRUE) -&gt;cCanada
  cCanada&lt;-na.omit(cCanada)

  cCanada %&gt;% 
    filter(Year&gt;1743) %&gt;%
    group_by(Year) %&gt;% 
    summarise(Temp = mean(AverageTemperature)) -&gt;cCanAvgTemp

  output$plot1 &lt;- renderPlot({
    plot(x = Year, y = AverageTemperature)
  })
}
</code></pre>