Chapter 4. Basic Expressions

Expressions are the building blocks of a function. R has a very clear syntax that suggests that an expression is either a symbol or a function call.

Although everything we do is in essence implemented by functions, R gives some functions a special syntax so that it is more friendly to write readable R code.

In the next few sections, we will see the following fundamental expressions that are given a special syntax:

  • Assignment expressions
  • Conditional expressions
  • Loop expressions

Assignment expressions

Assignment may be one of the most fundamental expressions in all programming languages. What it does is assign or bind a value to a symbol so that we can refer to the value by that symbol later.

Despite the similarity, R adopts ...

Get Learning R Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.