miscellaneous R functions I've found useful