| @@ -483,7 +483,7 @@ summarise(flights, delay = mean(dep_delay, na.rm = TRUE)) | |||||||
|  |  | ||||||
| (we'll come back to what that `na.rm = TRUE` means very shortly.) | (we'll come back to what that `na.rm = TRUE` means very shortly.) | ||||||
|  |  | ||||||
| `summarise()` is terribly useful unless we pair it with `group_by()`. This changes the unit of analysis from the complete dataset to individual groups. Then, when you use the dplyr verbs on a grouped data frame they'll be automatically applied "by group". For example, if we applied exactly the same code to a data frame grouped by date, we get the average delay per date: | `summarise()` is not terribly useful unless we pair it with `group_by()`. This changes the unit of analysis from the complete dataset to individual groups. Then, when you use the dplyr verbs on a grouped data frame they'll be automatically applied "by group". For example, if we applied exactly the same code to a data frame grouped by date, we get the average delay per date: | ||||||
|  |  | ||||||
| ```{r} | ```{r} | ||||||
| by_day <- group_by(flights, year, month, day) | by_day <- group_by(flights, year, month, day) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user