R TutorialLesson 12Free preview
R Operators
This lesson is part of R · All levels
Summary
This lesson reviews the various operators groups in R. R distinguishes the arithmetic operator (+, -, *, /, ^, %%, %/%), the comparison operator (==,!=, <, >), as well as the logic operator of single elements (&, ̊) and short scalar-evaluations (&&, ||). In addition, there is a range operator ':' and a matrix special operator '%*%'.
Key points
- The operator '^' is used for the exponential ranking
- The operator '%%' is the modulus, and '%/%' is the integer division
- The colon operator ':' creates a sequence of numbers (e.g.: 1:5)
- The operators '&' and 'b' operate on vector elements, while '&&' and 'b' scalars operate on a single element
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.