Example R code to use two functions