Useful little functions in R