Programming in R - homeworks