Table of Contents
Preface v
Chapter 1: Acquire and Prepare the Ingredients – Your Data 1
Introduction 2
Reading data from CSV files 2
Reading XML data 5
Reading JSON data 7
Reading data from fixed-width formatted files 8
Reading data from R files and R libraries 9
Removing cases with missing values 11
Replacing missing values with the mean 13
Removing duplicate cases 15
Rescaling a variable to [0,1] 16
Normalizing or standardizing data in a data frame 18
Binning numerical data 20
Creating dummies for categorical variables 22
Chapter 2: What's in There? – Exploratory Data Analysis 25
Introduction 26
Creating standard data summaries 26
Extracting a subset of a dataset 28
Splitting a dataset 31
Creating random data partitions 32
Generating standard plots such as histograms, boxplots, and scatterplots 35
Generating multiple plots on a grid 43
Selecting a graphics device 45
Creating plots with the lattice package