Table of Contents

    Miscellaneous Operators in R Programming Language: Overview and Examples

    Miscellaneous Operators in R Programming Language: Overview and Examples

    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

    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

    it produces the following result −

    [1] TRUE
    [1] FALSE
    %*% This operator is used to multiply a matrix with its transpose.
    R = matrix( c(2,6,5,1,10,4), nrow = 2,ncol = 3,byrow = TRUE)
    b = R %*% t(R)
    print(b)

    it produces the following result −

    [,1] [,2]
    [1,]   65   82
    [2,]   82  117