I owe a lot to Jeff Leek and Roger Peng for their great Coursera courses, in which I learned to program in R. They (along with Rafa Irizarry) run the Simply Statistics blog, which I highly reccomend. They posted a Thanksgiving puzzle in which a data.frame needs to be converted from one form to another, spelling out ‘thanksgiving’.
The puzzle: convert this
My solution, which uses Rubik’s Cube rotations of rows and columns (and dplyr of course):
Suggestions on how I could have done this differently (or automated solutions) most welcome!