The Art of R Programming - Index of
The Art of R Programming - Index of
The Art of R Programming - Index of
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
vi CONTENTS<br />
8.2 Arithmetic and Boolean Operators and Values . . . . . . . . . . . . . . . . . . . . . . . . . 70<br />
8.3 Type Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70<br />
9 R Functions 73<br />
9.1 Functions Are Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73<br />
9.2 Return Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74<br />
9.3 Functions Have (Almost) No Side Effects . . . . . . . . . . . . . . . . . . . . . . . . . . . 75<br />
9.3.1 Locals, Globals and Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75<br />
9.3.2 Writing to Globals Using the Superassignment Operator . . . . . . . . . . . . . . . 76<br />
9.3.3 Strategy in Dealing with Lack <strong>of</strong> Pointers . . . . . . . . . . . . . . . . . . . . . . . 76<br />
9.4 Default Values for Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77<br />
9.5 Functions Defined Within Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78<br />
9.6 Writing Your Own Binary Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78<br />
9.7 Editing Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79<br />
10 Doing Math in R 81<br />
10.1 Math Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81<br />
10.2 Functions for Statistical Distributions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82<br />
10.3 Sorting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82<br />
10.4 Linear Algebra Operations on Vectors and Matrices . . . . . . . . . . . . . . . . . . . . . . 83<br />
10.5 Extended Example: A Function to Find the Sample Covariance Matrix . . . . . . . . . . . . 84<br />
10.6 Extended Example: Finding Stationary Distributions <strong>of</strong> Markov Chains . . . . . . . . . . . 86<br />
10.7 Set Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88<br />
10.8 Simulation <strong>Programming</strong> in R . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88<br />
10.8.1 Built-In Random Variate Generators . . . . . . . . . . . . . . . . . . . . . . . . . . 89<br />
10.8.2 Obtaining the Same Random Stream in Repeated Runs . . . . . . . . . . . . . . . . 89<br />
10.9 Extended Example: a Combinatorial Simulation . . . . . . . . . . . . . . . . . . . . . . . . 89<br />
11 Input/Output 91