Two packages are required for this effort, so ensure they are installed on your system:
> library(forecast) > library(tseries)
Let's start out with plots of the two time series:
The output of the preceding command is as follows:
It appears that CO2 levels really started to increase after World War II and a rapid rise in temperature anomalies in the mid-1970s. There does not appear to be any obvious outliers, and variation over time appears constant. Using the standard procedure, we can see that the two series are highly correlated, as follows:
> cor(climate) CO2 Temp CO2 1.0000000 ...