Third programming assignment for the R course