Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
The lapply() function
Other apply() functions
The split-apply-combine pattern
21. lapply() + unlist()
Summary

Instruction

Great!

Exercise

What's the average price for each of Alex's three expenses (plane ticket, accommodations, daily expenses)? Follow these steps:

  1. Group the prices from the alex_trips data frame by the cost_type column. Save the results in a variable named alex_trip_costs_list.
  2. Use lapply() in combination with unlist() to display the result.