updated R file