3.2 Descriptive statistics
Now let’s calculate some basic statistics on the entire dataset. We’ll calculate the mean age, maximum height, and number of pirates of each sex:
Now, let’s calculate statistics for different groups of pirates. For example, the following code will use the aggregate()
function to calculate the mean age of pirates, separately for each sex.