fix: correct pipe precedence docs — |> binds tighter than +
R-CMD-check / R CMD check (push) Successful in 2m46s

R's |> has higher precedence than +, so parentheses ARE required
around the ggplot chain before piping to civilytics_logo():

  (ggplot(df, aes(x, y)) + geom_point() + theme_civilytics()) |>
    civilytics_logo()

Updated docs, examples, and pipe test accordingly.
This commit is contained in:
2026-05-17 22:54:53 -06:00
parent 7371069379
commit 099fff1d1d
4 changed files with 28 additions and 24 deletions
+5 -2
View File
@@ -190,8 +190,11 @@ test_that("civilytics_logo returns a grob", {
})
test_that("civilytics_logo works with pipe operator", {
p <- ggplot(mpg, aes(displ, hwy)) + geom_point() + theme_civilytics()
result <- suppressWarnings(p |> civilytics_logo())
# |> has higher precedence than +, so parens are required
result <- suppressWarnings(
(ggplot(mpg, aes(displ, hwy)) + geom_point() + theme_civilytics()) |>
civilytics_logo()
)
expect_s3_class(result, "grob")
})