The S Language

  • W. N. Venables
  • B. D. Ripley
Part of the Statistics and Computing book series (SCO)


S is a language for the manipulation of objects. It aims to be both an interactive language (like, for example, a Unix shell language) as well as a complete programming language with some convenient object-oriented features. In this chapter we shall be concerned with the interactive language, and hence certain language constructs used mainly in programming will be postponed to Chapter 4.


Dimension Vector Data Frame Character String Matrix Operation Search Path 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    When S writes objects onto an external file in assignment form (using dump) the left-hand side of each top level assignment is always placed in quotes, whether the name is standard or not.Google Scholar
  2. 2.
    These prompts can be altered: see Section 2.11.Google Scholar
  3. 3.
    If the expression consists of a simple name such as x , only, the . Last . value object is not changed.Google Scholar
  4. 4.
    In S-PLUS 3.4 and later an extra argument may be included when subsetting factors, as in f [i , drop=T] , to ensure that the levels are pruned to include only those which occur in the subset. Under the default, drop=F , the levels are not changed.Google Scholar
  5. 5.
    The result of e1 %/% e2 is floor(e1/e2) if e2!=0 and 0 if e2= 0. The result of e1 %% e2 is e1-floor (e1/e2) *e2 if e2 ! =0 and e1 otherwise (see Knuth, 1968, §1.2.4). Thus %/% and %% always satisfy e1==(e1%/%e2)*e2+e1%%e2.Google Scholar
  6. 6.
    If the argument to var is an n × p matrix the value is a p × p sample covariance matrix obtained by regarding the rows as sample vectors.Google Scholar
  7. 7.
    paste is discussed on page 42.Google Scholar
  8. 8.
    For precise details see page 153. 9 These object files should normally not be manipulated except through S-PLUS, although it is sometimes convenient to transfer them directly to another compatible computer.Google Scholar
  9. 10.
    There are further types of possible database which we have never had occasion to use.Google Scholar
  10. 11.
    Note that the object name as the argument to get must be given in quotes.Google Scholar
  11. 12.
    This example is artificial as there is a function diag that can be used for both purposes.Google Scholar
  12. 13.
    Note that the names are singular: it is all too easy to write nrows !Google Scholar
  13. 14.
    The use of “list” is unfortunate here since it has nothing to do with S list objects.Google Scholar
  14. 15.
    This is one of the few places where the recycling rule is disabled: the replacement must be a scalar or of the correct length.Google Scholar
  15. 16.
    if else is discussed on page 114.Google Scholar
  16. 17.
    The concept of class is discussed in Section 4.4 but the details are not required to understand the present section.Google Scholar
  17. 18.
    There is a bug in both 3.3 and 3.4 which prevents matrix indices being used on an assignment.Google Scholar

Copyright information

© Springer Science+Business Media New York 1997

Authors and Affiliations

  • W. N. Venables
    • 1
  • B. D. Ripley
    • 2
  1. 1.Department of StatisticsUniversity of AdelaideAdelaideAustralia
  2. 2.University of OxfordOxfordEngland

Personalised recommendations