### Flow Control, Iteration, Vectorizing (Introduction to Statistical Computing)

Lecture
3: Conditioning the calculation on the data: `if`; what is truth?;
Boolean operators again; `switch`. Iteration to repeat similar
calculations: `for` and iterating over a vector; `while` and
conditional iteration (reducing `for`
to `while`); `repeat` and unconditional iteration,
with `break` to exit loops (reducing `while` to `repeat`).
Avoiding iteration with "vectorized" operations and functions: the advantages
of the whole-object view; some examples and techniques: mathematical operators
and functions, `ifelse`; generating arrays with repetitive structure.

Introduction to Statistical Computing

Posted at September 04, 2013 01:41 | permanent link