Skip to content

Instantly share code, notes, and snippets.

View vintented's full-sized avatar

Vincent Jerosch-Herold vintented

  • @Asset-Resolution
  • Berlin
View GitHub Profile
@vintented
vintented / summarise_with.R
Created August 17, 2020 14:21
Thanks for the suggestion. I needed to added the .group parameter because otherwise some functions like sum will perhaps not behave as intended. Interested to hear your thoughts.
library(dplyr, warn.conflicts = FALSE)
library(rlang)
summarise_with <- function(.data, ..., .f, .with, .over, .group = TRUE, na.rm = TRUE) {
stopifnot(rlang::is_logical(.group))
if(rlang::quo_is_symbol(rlang::enquo(.with))) {
.with <- rlang::enquo(.with)
} else {