updated R functions
merge new R functions