Miscellaneous R code (experiments, forum replies, etc)