I would like to create a so-called correspondence vector consisting of binary files. All numbers must be zero if the elements do not belong to the same variable.
Here is an example:
dataset=("a","b","c","d","x","y","z") var1=c("a","b","y","z") var2=c("c","d","x")
So I have a dataset with all the variables in the first row. Now I create two groups: var1 and var2.
The corresponding vector for element "a" should look like this:
matching_a=c(1,1,0,0,0,1,1)
The numbers correspond to my data set. If the variables in my dataset are in the same group, there should be 1 in my matching vector, otherwise 0.
However, my actual dataset is too large to do it manually. Does anyone understand what I want to do?
source share