Skip to content
Prev 275900 / 398506 Next

element-by-element comparison

Hi Wendy,

Most of the binary operators can deal with matrices and vectors natively:

A<-c(12,3,4)
B<-matrix(c(4,10,4,13,2,8),3,2)

B
     [,1] [,2]
[1,]    4   13
[2,]   10    2
[3,]    4    8

B<A

      [,1]  [,2]
[1,]  TRUE FALSE
[2,] FALSE  TRUE
[3,] FALSE FALSE

Cheers,

Tsjerk
On Sun, Oct 30, 2011 at 8:55 AM, Jim Lemon <jim at bitwrit.com.au> wrote: