useful code snippets for data reshaping or extraction in R, excell and SPSS