r code

corrected code