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

Need Your Help

Mutating an upvar captured by value in a FnMut closure

closures rust

I am attempting to create a simple program, with a closure containing a collection that progressively empties itself:

Unable to access JBOSS server deployed on Amazon EC2

amazon-web-services jboss amazon-ec2

I have deployed jboss-4.2.3 on an EC2 instance. I have added appropriate rule to open port 8080 for inbound traffic. When I ssh into this instance and do curl localhost:8080, the expected response ...