Book Image

R Data Visualization Cookbook

Book Image

R Data Visualization Cookbook

Overview of this book

Table of Contents (17 chapters)
R Data Visualization Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating Chernoff faces in R


One of the alternative methods to visualize multivariate data is using Chernoff faces. Each variable in the dataset is used to represent a feature of the face. Chernoff used 18 variables to represent different facial features such as head, nose, eyes, eyebrows, mouth, and ears. Kosara (http://eagereyes.org/criticism/chernoff-faces) discusses the limitation of using Chernoff faces at length.

In order to construct Chernoff faces, I have downloaded some specific macroeconomic variables for a set of countries from the World Bank website.

Getting ready

We will implement Chernoff faces in R by using the faces() function available under the aplpack package in R.

How to do it…

To create Chernoff faces, we would require to install the aplpack package in R and load it in our active R session using the install.packages() and library() functions:

install.packages("aplpack")
library(aplpack)

We can load the data in R using the read.csv() function. Note that R will search for the...