recoding all the r code