Arithmetic and Boolean Operators and Values
Table 7-1 lists the basic operators.
Table 7-1. Basic R Operators
Operation | Description |
---|---|
| Addition |
| Subtraction |
| Multiplication |
| Division |
| Exponentiation |
| Modular arithmetic |
| Integer division |
| Test for equality |
| Test for less than or equal to |
| Test for greater than or equal to |
| Boolean AND for scalars |
| Boolean OR for scalars |
| Boolean AND for vectors (vector x,y,result) |
| Boolean OR for vectors (vector x,y,result) |
| Boolean negation |
Though R ostensibly has no scalar types, with scalars being treated as one-element vectors, we see the exception in Table 7-1: There are different Boolean operators for the scalar and vector cases. This may seem odd, but a simple ...
Get The Art of 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.