Contents
Preface v
Typographical Conventions xi
1 Introduction 1
1.1 A Quick Overview of S ....................... 3
1.2 Using S ............................... 5
1.3 An Introductory Session . . . . . ................. 6
1.4 WhatNext? ............................. 12
2 DataManipulation 13
2.1 Objects ............................... 13
2.2 Connections............................. 20
2.3 DataManipulation ......................... 27
2.4 TablesandCross-Classification................... 37
3The S Language 41
3.1 Language Layout . . ........................ 41
3.2 More on S Objects ......................... 44
3.3 ArithmeticalExpressions...................... 47
3.4 CharacterVectorOperations .................... 51
3.5 Formatting and Printing . . . . . . ................. 54
3.6 Calling Conventions for Functions ................. 55
3.7 ModelFormulae........................... 56
3.8 ControlStructures.......................... 58
3.9 ArrayandMatrixOperations.................... 60
3.10 Introduction to Classes and Methods . . . ............. 66
4 Graphics 69
4.1 GraphicsDevices .......................... 71
4.2 Basic Plotting Functions . . . . . ................. 72
viiviii Contents
4.3 EnhancingPlots........................... 77
4.4 FineControlofGraphics ...................... 82
4.5 Trellis Graphics . . . ........................ 89
5 Univariate Statistics 107
5.1 Probability Distributions . . . . . .................107
5.2 Generating Random Data . . . . . .................110
5.3 DataSummaries...........................111
5.4 ClassicalUnivariateStatistics....................115
5.5 RobustSummaries .........................119
5.6 DensityEstimation .........................126
5.7 Bootstrap and Permutation Methods . . . .............133
6 Linear StatisticalModels 139
6.1 AnAnalysisofCovarianceExample................139
6.2 ModelFormulaeandModelMatrices ...............144
6.3 Regression Diagnostics . . . . . . .................151
6.4 SafePrediction ....................
1