chapter  5
27 Pages

Functions

ByJohn M. Chambers

This chapter deals with some aspects of functions likely to arise in extending R. It describes the functional programming to R, with emphasis on achieving and demonstrating functional behavior, a contribution to the reliability and safety of an extension to R. The chapter analyzes that aspect of R computations that differ from many other languages and may need to be understood to program effectively. It discusses replacement expressions that assign or modify objects in the local environment. R has a particularly flexible approach to such expressions. The chapter also discusses techniques to compute with language objects. Most languages allow only a fixed set of expressions on the left side of an assignment—what are traditionally called "lvalues". Computing on the language is a key to development and testing phases of computation. Tools exist to examine and describe the software, for the purpose of diagnosing programming problems.