edited as required by R programming course