I have a dataframe, df with two variables as given below. Using the code below, I want to get matrix "mat".
This code works perfect for unique(df$V1)= 3 but