added r code