some handy R scripts and functions for various common tasks