Pluralsight audition - aggregate function in R