this is the R file for PS2