November 2025
Intermediate to advanced
936 pages
24h 27m
English
To write more sophisticated programs with R, you’ll need to control the flow and order of execution in your code. One fundamental way to do this is to make the execution of certain sections of code dependent on some condition, always provided as a single logical value (TRUE or FALSE). Another basic control mechanism is the loop, which repeats a block of code a certain number of times. In this chapter, we’ll explore these core programming techniques using if...else statements, for and while loops, and other control structures.
The if statement is the key to controlling exactly which operations are carried ...
Read now
Unlock full access