Repository for some general helper functions in R, called by much of Tom's other code.