Miscellaneous Operators in R Programming Language
Table of Content:
Miscellaneous Operators
These operators are used to for specific purpose and not general mathematical or logical computation.
Operator | Description | Example |
---|---|---|
: | Colon operator. It creates the series of numbers in sequence for a vector. | a <- 2:8 print(a) it produces the following result − [1] 2 3 4 5 6 7 8 |
%in% | This operator is used to identify if an element belongs to a vector. | a1 <- 8 a2 <- 12 b <- 1:10 print(a1 %in% b) print(a2 %in% b) it produces the following result − [1] TRUE [1] FALSE |
%*% | This operator is used to multiply a matrix with its transpose. |
it produces the following result − [,1] [,2] [1,] 65 82 [2,] 82 117 |