Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
We’ll use a subset of the climate data and create a new column called
pos, which indicates whether the
value is positive or negative:
library(gcookbook)# For the data setcsub<-subset(climate,Source=="Berkeley"&Year>=1900)csub$pos<-csub$Anomaly10y>=0csubSource Year Anomaly1y Anomaly5y Anomaly10y Unc10y Berkeley1900NANA-0.1710.108FALSEBerkeley1901NANA-0.1620.109FALSEBerkeley1902NANA-0.1770.108FALSE...Berkeley2002NANA0.8560.028TRUEBerkeley2003NANA0.8690.028TRUEBerkeley2004NANA0.8840.029TRUE