Updated lab2 for R