edited .R file

locally tests ok