These are the R codes

Separated from master file