Well done! The
summary() function can also be called on a whole data frame! In that case, R will calculate summary statistics for each numeric column in parallel.
As a result, R will display summary statistics for each
of your table. Calculations will be performed
only on numeric columns
. R will
skip character columns
, which will be marked in the output as
so the analyst knows why statistics were not presented for such columns.
Let's try to use
summary() on the entire
cities data frame:
Here's the result:
country ... latitude ...
Length:205 ... Min. :-21.03 ...
Class :character ... 1st Qu.: 44.85 ...
Mode :character ... Median : 49.50 ...
Mean : 45.74 ...
3rd Qu.: 52.05 ...
Max. : 54.78 ...
As you can see,
city are character columns, so summary statistics cannot be displayed for them. For the other columns, statistics were calculated and presented in the same output at once.