general R code for the simple things in life