Here is my script, but then I got stuck trying to figure out melt() and cast().
Merge branch 'master' of https://github.com/PermuteSeminar/PermuteSeminar-2014