Okay, I am going to look at annual mean concentrations of NO_2 in the UK at urban background monitoring sites, 1990-2019. Data from Gov.uk

#this is to set a working directory
setwd("C:\\Users\\melvo\\Documents\\CCMF\\Quantitive methods")

#this checks the working directory
getwd()
## [1] "C:/Users/melvo/Documents/CCMF/Quantitive methods"
#selecting your dataset
pollution <- read.csv("data_for_3.csv")
library(ggplot2)
ggplot(pollution, aes(x = Year, y = Mean)) +
    geom_smooth(method = "lm", se = FALSE) +
    geom_point()+theme_minimal()+
    geom_errorbar(data = pollution, aes(x=Year, y=Mean, ymin= Mean - Confidence/2, ymax=Mean +Confidence/2)) + 
    xlab("Year")+ylab("Mean Annual NO2 Concentrations") + ggtitle("Annual Mean Concentrations of NO2 at UK urban background monitoring sites")
## `geom_smooth()` using formula 'y ~ x'

  reg1=lm(Year~Mean,pollution)
  summary(reg1)
## 
## Call:
## lm(formula = Year ~ Mean, data = pollution)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -4.1901 -1.8888 -0.0684  1.9029  5.3672 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 2030.09360    1.46186 1388.70   <2e-16 ***
## Mean          -0.72435    0.03935  -18.41   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 2.475 on 28 degrees of freedom
## Multiple R-squared:  0.9237, Adjusted R-squared:  0.921 
## F-statistic: 338.9 on 1 and 28 DF,  p-value: < 2.2e-16