Figure 10.1: Histogram of Mauna Loa carbon dioxide concentrations between 1959 and 1997.

par(mar=c(5,4,3,4))


summary(co2)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   313.2   323.5   335.2   337.1   350.3   366.8
str(co2)    
##  Time-Series [1:468] from 1959 to 1998: 315 316 316 318 318 ...
temp.data <-as.data.frame(co2) 
names(temp.data) <- c("co2")
with(temp.data, hist(co2, col= 'lightgrey', border= 'black',       
      main= "Histogram of Mauna Loa CO2 Concentrations",                                        
      xlab= "CO2 (ppm)", xlim= c(300,380), ylim= c(0,80)))

with(temp.data, t.test(co2, mu = 338))
## 
##  One Sample t-test
## 
## data:  co2
## t = -1.3681, df = 467, p-value = 0.1719
## alternative hypothesis: true mean is not equal to 338
## 95 percent confidence interval:
##  335.6941 338.4130
## sample estimates:
## mean of x 
##  337.0535