Various helpful (to me) R functions