Operators

These are the operators supported by R.


Description

Most operators work as expected. Some are spelled in unexpected ways, though.

If both arguments to an operator are vectors, element-wise operations are performed.

R does not support a transposition operator. Instead use the 'transposition' function.

A_t = t(A)

Note that this gives the non-conjugate transpose. To get the Hermitian transpose, try Conj(t(A)).

For matrix multiplication, use %*%.

R does not support a matrix division operator. Instead use the solve function.

& and | are vectorized operators that return logical vectors. && and || are the more familiar logic operators, i.e. they evaluate to TRUE or FALSE and feature short-circuiting. Note that R considers very few things to be 'falsy':


CategoryRicottone

R/Operators (last edited 2026-07-19 18:30:06 by DominicRicottone)