# Logical Comparison of Lists

I am trying to compare the columns in a data frame to a master list. I would like R to compare the values in each cell and output T if they match and F if they do not.

For example:

Master m<-c(1,2,2,2,1) Data a<-c(1,2,2,2,2) b<-c(1,1,1,1,1) c<-c(1,1,2,2,2) d<-cbind(a,b,c) Result of comparing m to the columns in d a b c 1 T T T 2 T F F 3 T F T 4 T F T 5 F T F

How might I achieve a comparison with this sort of output?

Thank you in advance!

## Answers

simply :

d==m a b c [1,] TRUE TRUE TRUE [2,] TRUE FALSE FALSE [3,] TRUE FALSE TRUE [4,] TRUE FALSE TRUE [5,] FALSE TRUE FALSE