Miscellaneous R scripts for data analysis