Added some simple functions in R