JJH version of R homework