I have a question about matching columns and replace this with a 1 if there is a match and 0 if there is no match. I have a matrix with columnnames. I want to match ik with 3 other dataframe columns and replace in that matrix if it is a match or not.
Finally i want to create this matrix:
dataframe1 dataframe2 dataframe3
aaa 1 0 0
aab 0 1 0
aac 1 0 0
aad 0 1 1
aae 1 1 1
dataframe1 <- c("aaa","aac","aae")
dataframe2 <- c("aab","aad","aae")
dataframe3 <- c("aad","aae")
Can anyone help me with this?
Here you go: