Utility functions I use frequently in R