Added R function