Create miscFunctions.r

Includes optimal weight clustering using k-means.