Thanks @gueyenono
Having thought about this, I think that it is the same unless there is a duplicate row
library(dplyr)
d <- tibble( #new data with last row duplicated
g = c("A", "B", "A"),
x = c(1, 2, 1),
y = c(1, 2, 1),
z = c(1, 2, 1)
)
d %>%
group_by(across(everything())) %>%
mutate(m = mean(x, y, z)) #breaks
d %>%
rowwise() %>%
mutate(m = mean(x, y, z)) #works