Draft R codes