Miscellaneous R functions
