Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
A scatter plot matrix is an excellent way of visualizing the
pairwise relationships among several variables. To make one, use the
pairs() function from R’s base graphics.
For this example, we’ll use a subset of the countries data set. We’ll pull out the data
for the year 2009, and keep only the columns that are
relevant:
library(gcookbook)# For the data setc2009<-subset(countries,Year==2009,select=c(Name,GDP,laborrate,healthexp,infmortality))c2009Name GDP laborrate healthexp infmortality AfghanistanNA59.850.88597103.2Albania3772.604759.5264.6040617.2Algeria4022.198958.5267.9465332.0...Zambia1006.388269.247.0563771.5Zimbabwe467.853466.8NA52.2