演算子の優先順序
こちらのR入門資料から、
?Syntax
で、単項演算子(unary operators)と二項演算子(binary operators)の優先順位(precedence)が表示できる。
演算子に関する一般的な事項はこちら。
The following unary and binary operators are defined. They are listed in precedence groups, from highest to lowest. '[ [[' indexing ':: :::' access variables in a name space '$ @' component / slot extraction '^' exponentiation (right to left) '- +' unary minus and plus ':' sequence operator '%any%' special operators '* /' multiply, divide '+ -' (binary) add, subtract '< > <= >= == !=' ordering and comparison '!' negation '& &&' and '| ||' or '~' as in formulae '-> ->>' rightwards assignment '=' assignment (right to left) '<- <<-' assignment (right to left) '?' help (unary and binary) Within an expression operators of equal precedence are evaluated from left to right except where indicated. The links in the *See Also* section cover most other aspects of the basic syntax.