Skip to content

Instantly share code, notes, and snippets.

@klmr
Last active February 12, 2018 12:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save klmr/f42ba1b56d485e44f31efd116b400a2e to your computer and use it in GitHub Desktop.
Save klmr/f42ba1b56d485e44f31efd116b400a2e to your computer and use it in GitHub Desktop.
Summarise a column in a (grouped) tibble
summary.tbl_df = function (object, ...) {
dots = rlang::quos(...)
stopifnot(length(dots) == 1)
name = rlang::quo_name(dots[[1]])
do(object, as_data_frame(as.list(summary(.[[name]]))))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment