I have a dataframe, dt with two variables as given below. Using the code below, I want to get matrix G.
V1 V2 1 60 1 30 1 38 1 46 2 29 2 35 2