### Flow Control, Looping, 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 07, 2012 00:30 | permanent link