
Messages about .groups=
=======================

> ignored <- tibble(x = 1, y = 2) %>% group_by(x, y) %>% summarise()
Message: `summarise()` has grouped output by 'x'. You can override using the `.groups` argument.

> ignored <- tibble(x = 1, y = 2) %>% group_by(x, y) %>% summarise(z = c(2, 2))
Message: `summarise()` has grouped output by 'x', 'y'. You can override using the `.groups` argument.

> ignored <- tibble(x = 1, y = 2) %>% rowwise(x, y) %>% summarise()
Message: `summarise()` has grouped output by 'x', 'y'. You can override using the `.groups` argument.

> ignored <- tibble(x = 1, y = 2) %>% rowwise() %>% summarise()
Message: `summarise()` has ungrouped output. You can override using the `.groups` argument.


unsupported type
================

> tibble(x = 1, y = c(1, 2, 2), z = runif(3)) %>% summarise(a = rlang::env(a = 1))
Error: Problem with `summarise()` input `a`.
x Input `a` must be a vector, not an environment.
i Input `a` is `rlang::env(a = 1)`.

> tibble(x = 1, y = c(1, 2, 2), z = runif(3)) %>% group_by(x, y) %>% summarise(a = rlang::env(
+   a = 1))
Error: Problem with `summarise()` input `a`.
x Input `a` must be a vector, not an environment.
i Input `a` is `rlang::env(a = 1)`.
i The error occurred in group 1: x = 1, y = 1.

> tibble(x = 1, y = c(1, 2, 2), z = runif(3)) %>% rowwise() %>% summarise(a = lm(
+   y ~ x))
Error: Problem with `summarise()` input `a`.
x Input `a` must be a vector, not a `lm` object.
i Did you mean: `a = list(lm(y ~ x))` ?
i Input `a` is `lm(y ~ x)`.
i The error occurred in row 1.


mixed types
===========

> tibble(id = 1:2, a = list(1, "2")) %>% group_by(id) %>% summarise(a = a[[1]])
Error: Problem with `summarise()` input `a`.
x Input `a` must return compatible vectors across groups
i Result type for group 1 (id = 1): <double>.
i Result type for group 2 (id = 2): <character>.
i Input `a` is `a[[1]]`.

> tibble(id = 1:2, a = list(1, "2")) %>% rowwise() %>% summarise(a = a[[1]])
Error: Problem with `summarise()` input `a`.
x Input `a` must return compatible vectors across groups
i Input `a` is `a[[1]]`.


incompatible size
=================

> tibble(z = 1) %>% summarise(x = 1:3, y = 1:2)
Error: Problem with `summarise()` input `y`.
x Input `y` must be size 3 or 1, not 2.
i An earlier column had size 3.
i Input `y` is `1:2`.

> tibble(z = 1:2) %>% group_by(z) %>% summarise(x = 1:3, y = 1:2)
Error: Problem with `summarise()` input `y`.
x Input `y` must be size 3 or 1, not 2.
i An earlier column had size 3.
i Input `y` is `1:2`.
i The error occurred in group 1: z = 1.

> tibble(z = c(1, 3)) %>% group_by(z) %>% summarise(x = seq_len(z), y = 1:2)
Error: Problem with `summarise()` input `y`.
x Input `y` must be size 3 or 1, not 2.
i An earlier column had size 3.
i Input `y` is `1:2`.
i The error occurred in group 2: z = 3.


Missing variable
================

> summarise(mtcars, a = mean(not_there))
Error: Problem with `summarise()` input `a`.
x object 'not_there' not found
i Input `a` is `mean(not_there)`.

> summarise(group_by(mtcars, cyl), a = mean(not_there))
Error: Problem with `summarise()` input `a`.
x object 'not_there' not found
i Input `a` is `mean(not_there)`.
i The error occurred in group 1: cyl = 4.


.data pronoun
=============

> summarise(tibble(a = 1), c = .data$b)
Error: Problem with `summarise()` input `c`.
x Column `b` not found in `.data`
i Input `c` is `.data$b`.

> summarise(group_by(tibble(a = 1:3), a), c = .data$b)
Error: Problem with `summarise()` input `c`.
x Column `b` not found in `.data`
i Input `c` is `.data$b`.
i The error occurred in group 1: a = 1.


Duplicate column names
======================

> tibble(x = 1, x = 1, .name_repair = "minimal") %>% summarise(x)
Error: Can't transform a data frame with duplicate names.


Not glue()ing
=============

> tibble() %>% summarise(stop("{"))
Error: Problem with `summarise()` input `..1`.
x {
i Input `..1` is `stop("{")`.

> tibble(a = 1, b = "{value:1, unit:a}") %>% group_by(b) %>% summarise(a = stop(
+   "!"))
Error: Problem with `summarise()` input `a`.
x !
i Input `a` is `stop("!")`.
i The error occurred in group 1: b = "{value:1, unit:a}".

