First commit to add R function.