functions from R exercise 1