updated R scripts