knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(dplyr, warn.conflicts = FALSE)

Missing an ungroup() in standard dplyr

res1 <- mtcars %>%
  group_by(cyl) %>%
  mutate(max_mpg = max(mpg))

Load strictlyr for a noisy pipe

strictlyr includes a noisy pipe which shows a warning if the input or output from a chain of operations has groups

library(strictlyr, warn.conflicts = FALSE)

Missing an ungroup() when strictlyr is loaded

res1 <- mtcars %>%
  group_by(cyl) %>%
  mutate(max_mpg = max(mpg))

Missing an ungroup() when strictlyr is loaded, but it's told to be quiet

options(STRICTLYR_PIPE = 'quiet')

res1 <- mtcars %>%
  group_by(cyl) %>%
  mutate(max_mpg = max(mpg))


coolbutuseless/strictlyr documentation built on Dec. 9, 2019, 12:15 a.m.