final submission of R codes