added h/w 2 R code