D3 and R code