Chapter 1: Introduction 1.1 Invoking S 1.2 Online Help 1.3 Data 1.4 The Basics of S 1.5 A Sample S Session 1.6 Using S with a Command File 1.7 Interrupting S 1.8 Accessing Your Operating System from S 1.9 Initialization and Wrapup 1.10 Options Chapter 2: Data in S 2.1 Information About Objects 2.2 Reading Data into S 2.3 Generating Data in S 2.4 How S Finds Data 2.5 Organizing Data 2.5.1 Organizing Data: Lists 2.5.2 Organizing Data: Matrices 2.5.3 Organizing Data: Data Frames 2.6 Time Series 2.7 Complex Numbers 2.8 Libraries 2.9 Advanced Topics 2.9.1 Attributes 2.9.2 Access to Data 2.9.3 Direct Access to Data 2.9.4 Advanced Features of the scan Function Reading Part of a File Reading Data Directly into a List Chapter 3: Operators and Functions 3.1 Arithmetic Operators 3.2 Logical Operators 3.3 Special Operators 3.4 Operator Precedence 3.5 Introduction to Functions 3.6 Mathematical Functions 3.6.1 General Mathematical Functions 3.6.2 Trigonometric Functions 3.6.3 Functions for Complex Numbers 3.6.4 Functions for Rounding and Truncating 3.6.5 Mathematical Functions for Matrices 3.7 Functions for Sorting 3.8 Functions for Data Manipulation 3.9 Functions for Simple Statistics 3.10 Functions for Probability Distributions 3.10.1 Probability Density 3.10.2 Probabilities 3.10.3 Quantiles 3.10.4 Random Samples 3.11 Functions for Categorical Variables 3.12 Functions for Character Manipulation Chapter 4: Introduction to Graphics in S 4.1 Overview 4.2 High-Level Plotting Commands 4.3 Arrangement of Plots on the Page or Screen 4.4 Interacting with Plots 4.5 Commands for Graphics Examples Chapter 5: Subsetting and Reshaping Data 5.1 Subscripting 5.1.1 Accessing Vector Elements 5.1.2 Accessing Matrix Elements 5.1.3 Accessing List Elements 5.1.4 Accessing Data Frame Elements 5.2 Combining Vectors, Matrices, Lists, and Data Frames 5.3 Functions for Subsetting or Reshaping Matrices Chapter 6: Functions in S 6.1 Getting Started with Functions 6.2 Modifying an Existing Function Using fix 6.3 Modifying an Existing Function Using Editor Commands 6.4 Errors in Writing Functions 6.5 Creating a New Function 6.6 Checking for Function Name Clashes 6.7 Returning Multiple Values 6.8 Errors and Warnings 6.9 Local Variables and Evaluation Frames 6.10 Cleaning Up 6.11 Advanced Topics 6.11.1 Variable Numbers of Arguments 6.11.2 Retrieving Names of Arguments 6.11.3 Operators 6.11.4 Assignment Functions 6.11.5 Default Values 6.12 Dynamic Loading of Outside Routines 6.12.1 A Simple Example C FORTRAN 6.12.2 Communicating with S Functions 6.12.3 More Complex Issues Missing Values Matrices Multiple Object Files and Libraries 6.13 Static Loading Chapter 7: Programming in S 7.1 Mapping Functions to a Matrix 7.2 Mapping Functions to Vectors and Lists 7.3 Mapping Functions Based on Groups 7.4 Conditional Computations 7.5 Loops 7.5.1 for Loops 7.5.2 while Loops 7.5.3 Control Inside Loops: next and break 7.5.4 repeat Loops 7.6 Advanced Topics 7.6.1 Calling Functions with Lists of Arguments 7.6.2 Evaluating Text as Commands 7.6.3 Object-Oriented Programming Chapter 8: Printing and Formatting 8.1 Sending Output to a File 8.2 Writing S Objects for Transport 8.3 Command History 8.4 Command Re-editing 8.5 Customized Printing 8.6 Formatting Numbers 8.7 Printing Tables 8.8 Accessing the Operating System Chapter 9: Advanced Graphics 9.1 Overview 9.2 Graphics Parameters 9.3 Layout of Graphics 9.4 Low-Level Plotting Commands 9.5 Annotating Plots with Text 9.6 Using the Plotting Commands 9.6.1 Multiple Lines or Groups of Points on a Plot 9.6.2 Legends 9.6.3 Multiple Plots with Identical Axes 9.6.4 Special Plotting Characters 9.6.5 Logarithmic Axes 9.6.6 Custom Axes 9.6.7 Customizing Barplots and Histograms 9.6.8 Annotating a Perspective (3-D) Plot 9.6.9 Drawing Diagrams 9.7 Postscript Device Driver in S-PLUS 9.8 Postscript Device Driver in S 9.9 Multiple Graphics Devices in S-PLUS 9.10 More Complex Layouts Chapter 10: Statistical Models 10.1 Data for Statistical Models 10.2 Expressing a Statistical Model 10.3 Common Arguments to the Modeling Functions 10.3.1 formula Argument to the Modeling Functions 10.3.2 data Argument to the Modeling Functions 10.3.3 subset Argument to the Modeling Functions 10.3.4 weights Argument to the Modeling Functions 10.3.5 na.action Argument to the Modeling Functions 10.3.6 control Argument to the Modeling Functions 10.4 Using the Statistical Modeling Objects 10.5 Linear Models and Regression (lm) 10.5.1 Example: Linear Regression 10.6 Analysis of Variance (aov) 10.6.1 Example: One-Way Analysis of Variance 10.6.2 Example: Two-Way Analysis of Variance 10.7 Generalized Linear Models (glm) 10.7.1 Families, Links, and Error Distributions 10.7.2 Example: Logistic Regression 10.7.3 Example: Log-Linear Model 10.8 Generalized Additive Models (gam) 10.8.1 Example: General Additive Model 10.9 Local Regression Models (loess) 10.9.1 Example: Local Regression Model 10.10Tree-Based Models (tree) 10.10.1 Example: Tree-Based Model for Classification 10.11Nonlinear Regression (nls) 10.11.1 Example: Nonlinear Regression 10.12Simple Statistical Inference 10.13Multivariate Statistical Procedures 10.14Function Minimization (ms) 10.14.1 Example: Minimization Chapter 11: Applied Statistical Models 11.1 Graphics and Statistical Models 11.2 Sequential and Partial Sums of Squares 11.3 Contrasts and Model Matrices 11.4 Regression Diagnostics 11.5 Predicted and Fitted Values 11.6 Updating and Comparing Models 11.7 Stepwise Model Selection