Skip to main content

About this book

S is a high-level language for manipulating, analysing and displaying

data. It forms the basis of two highly acclaimed and widely used data

analysis software systems, the commercial S-PLUS® and the Open

Source R. This book provides an in-depth guide to writing software in

the S language under either or both of those systems. It is intended

for readers who have some acquaintance with the S language and want to

know how to use it more effectively, for example to build re-usable

tools for streamlining routine data analysis or to implement new

statistical methods.

One of the outstanding strengths of the S language is the ease with

which it can be extended by users. S is a functional language, and

functions written by users are first-class objects treated in the same

way as functions provided by the system. S code is eminently readable

and so a good way to document precisely what algorithms were used, and

as much of the implementations are themselves written in S, they can be

studied as models and to understand their subtleties. The current

implementations also provide easy ways for S functions to call

compiled code written in C, Fortran and similar languages; this is

documented here in depth.

Increasingly S is being used for statistical or graphical analysis

within larger software systems or for whole vertical-market

applications. The interface facilities are most developed on

Windows® and these are covered with worked examples.

The authors have written the widely used Modern Applied Statistics

with S-PLUS, now in its third edition, and several software libraries

that enhance S-PLUS and R; these and the examples used in both books

are available on the Internet.

Dr. W.N. Venables is a senior Statistician with the CSIRO/CMIS

Environmetrics Project in Australia, having been at the Department of

Statistics, University of Adelaide for many years previously.

Professor B.D. Ripley holds the Chair of Applied Statistics at the

University of Oxford, and is the author of four other books on spatial

statistics, simulation, pattern recognition and neural networks. Both

authors are known and respected throughout the international S and R

communities, for their books, workshops, short courses, freely

available software and through their extensive contributions to the

S-news and R mailing lists.

Table of Contents


Chapter 1. Introduction

S is a language for “programming with data”, in the words of the title of Chambers (1998). John Chambers of Bell Labs (formerly part of AT&T, currently part of Lucent Technologies) has been its principal designer over more than two decades, and was awarded the prestigious 1998 Association for Computing Machinery Award for Software Systems for, in the words of the citation,
the S system, which has forever altered how people analyze, visualize, and manipulate data.
For the last decade it has been the major vehicle for the delivery of new statistical methodology to end users.
W. N. Venables, B. D. Ripley

Chapter 2. The S Language: Syntax and Semantics

This chapter provides a reprise of the material introduced in Chapters 2 and 3 of MASS. Chapter 3 introduces more advanced language concepts that are important for programming: there are also class-oriented features which we discuss in Chapters 4 and 5.
W. N. Venables, B. D. Ripley

Chapter 3. The S Language: Advanced Aspects

In this chapter we consider the details which are not normally important in interactive use of S, and some more formal aspects of the language.
W. N. Venables, B. D. Ripley

Chapter 4. Classes

This chapter covers the class-oriented features of the old S engine and of R. Most of these exist for backward compatibility in the new S engine (see Section 5.4), but the features introduced in the next chapter are preferred for new projects in that system.
W. N. Venables, B. D. Ripley

Chapter 5. New-style Classes

The new S engine introduced a very different approach to classes, although backwards compatibility is provided for the classes as described in Chapter 4. The current S-PLUS systems rely very heavily on this backwards compatibility; at present new-style classes are used only at a low level and in the time-series manipulation software. The definitive reference for the new-style classes is Chambers (1998).
W. N. Venables, B. D. Ripley

Chapter 6. Using Compiled Code

A very important and powerful feature of the S environment is that it is not restricted to functions written in the S language but may load and use compiled routines written in C or Fortran, or perhaps other languages.1 Moreover there are ways in which such externally written and compiled routines may communicate with the S session and make use of S functions and objects. In the new S engine and in R it is possible to manipulate S objects in C through the. Call interface.
W. N. Venables, B. D. Ripley

Chapter 7. General Strategies and Extended Examples

Most S-PLUS programmers find early in their careers that they have written code which exhausts the physical memory (RAM) available to the S-PLUS process, and then proceeds to spend almost all its time in allocating virtual memory. Such code can reduce the fastest workstation to page thrashing, which will reduce severely the size of problem which can be tackled. This chapter give some hints on using S more efficiently.
W. N. Venables, B. D. Ripley

Chapter 8. S Software Development

In this chapter we consider the tools available for the process of software development in the S language. Such tools are often a matter of personal taste so many are available, and our aim is to cover all the possibilities at fairly shallow level.
W. N. Venables, B. D. Ripley

Chapter 9. Interfaces under Windows

S-PLUS 4.x for Windows introduced a new way to program menus and dialogs. In essence the system programs the Axum engine on which the 4.x GUI is based. Even those who much prefer the command-line interface (including the authors) may find they need to develop a graphical user interface to their functions to enable other people to make use of them.
W. N. Venables, B. D. Ripley


Additional information