Introduction

Instruction

In R, all operations we perform rely on functions. Some functions calculate values, while others manipulate data structures or perform input/output operations. You’ve already seen one function in action – head(). Certain functions, like mean(), calculate numerical results. For example, we can calculate the average price of cars with the following line of R code:

mean(cars$price)

Exercise

Use the median() function to calculate the median price of cars in the cars data frame.

Stuck? Here's a hint!

Type:

median(cars$price)