Control structures in R

R has the appearance of a procedural programming language. However, it is built on another language, known as S programming language. S leans towards functional programming. It also has some object-oriented characteristics. This means that there are many complexities in the way that R works.

In this section, we will look at some of the fundamental building blocks that make up key control structures in R, and then we will move onto looping and vectorized operations.

Assignment operators

R has five assignment operators, which are listed here:






In this book, we will use the following assignment operator:


We will use this assignment operator here, because it is used commonly in examples on well-known internet ...

Get Advanced Analytics with R and Tableau now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.