added example R code