Completed the toy example for R