In this chapter, you will use conditional and repetition operators in R. This chapter covers the following recipes:
- The use of the if conditional statement
- The use of the if…else conditional operator
- The use of the ifelse vectorised conditional operator
- Writing a function using the switch operator
- Comparing the performance of switch and series of the if…else statements
- Using for loop for iterations
- Vectorised operation versus for loop