Adding pre processing r code