Miscellaneous R functions for research.