I have the following data frame with one categorical and two numerical columns:
V1 V2 V3
1 A 1 3
2 A 3 5
3 B 3 3
4 C 2 3
I have turned this into the following dummy variables:
V1.1 V1.2 V1.3 V2 V3
1 1 0 0 1 3
2 1 0 0 3 5
3 0 1 0 3 3
4 0 0 1 2 3
Now, I want to apply clustering to this latter set. I guess that I could get better results if I downweight the dummy variable columns (proportionally to their number) because with equal weights the distance based clusters will be distorted.
My question is, how could I get the following weight vector from the new data set:
0.33, 0.33, 0.33, 1, 1
data.frame(model.matrix(label~. -1, data))
$\endgroup$