Learn R Programming

muStat (version 1.7.0)

mu.GE: GE Matrix

Description

mu.GE returns a matrix with each element denoting the logical value if one value is greater than or equal to another.

Usage

mu.GE(x, y=x)

Arguments

x
data matrix, variables as columns
y
second data matrix, optional

Value

a vector which contains the GE matrix.

Algorithm

 
mu.GE <- function(x, y=x) {
  <\dots>
  if (length(y)>1)
    apply(rbind(x,y),2,mu.GE,nrow(x))
  else 
    as.numeric(NAtoZer(outer(x[1:y],x[-(1:y)],">=")))
}

Details

The (i,j) entry of GE matrix is 1 if $\code{x_i >= y_j}$, 0 otherwise. The square matrix GE is stored by column in a vector.

Examples

Run this code
a <- c(4, 2, 5, 1, 4, NA, 6)
mu.GE(a)

Run the code above in your browser using DataLab