more work on R code