Skip to content

Commit 8bb9641

Browse files
authored
Move {tibble} to suggests (#5990)
* don't use `tibble()` in code * remove `tibble()` from examples/tests * redocument * add news bullet
1 parent bcb87fc commit 8bb9641

13 files changed

+36
-61
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ Imports:
4242
rlang (>= 1.1.0),
4343
scales (>= 1.3.0),
4444
stats,
45-
tibble,
4645
vctrs (>= 0.6.0),
4746
withr (>= 2.5.0)
4847
Suggests:
@@ -67,6 +66,7 @@ Suggests:
6766
sf (>= 0.7-3),
6867
svglite (>= 2.1.2),
6968
testthat (>= 3.1.5),
69+
tibble,
7070
vdiffr (>= 1.0.6),
7171
xml2
7272
Enhances:

NAMESPACE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,6 @@ importFrom(grid,unit)
735735
importFrom(lifecycle,deprecated)
736736
importFrom(scales,alpha)
737737
importFrom(stats,setNames)
738-
importFrom(tibble,tibble)
739738
importFrom(utils,.DollarNames)
740739
importFrom(utils,head)
741740
importFrom(utils,tail)

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@
159159
(@teunbrand, #4584).
160160
* `theme_classic()` now has black ticks and text instead of dark gray. In
161161
addition, `theme_classic()`'s axis line end is `"square"` (@teunbrand, #5978).
162+
* {tibble} is now suggested instead of imported (@teunbrand, #5986)
162163

163164
# ggplot2 3.5.1
164165

R/facet-.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ is_facets <- function(x) {
564564
# but that seems like a reasonable tradeoff.
565565
eval_facets <- function(facets, data, possible_columns = NULL) {
566566
vars <- compact(lapply(facets, eval_facet, data, possible_columns = possible_columns))
567-
data_frame0(tibble::as_tibble(vars))
567+
data_frame0(!!!vars)
568568
}
569569
eval_facet <- function(facet, data, possible_columns = NULL) {
570570
# Treat the case when `facet` is a quosure of a symbol specifically

R/position-stack.R

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,12 @@
116116
#'
117117
#' # Negative values -----------------------------------------------------------
118118
#'
119-
#' df <- tibble::tribble(
120-
#' ~x, ~y, ~grp,
121-
#' "a", 1, "x",
122-
#' "a", 2, "y",
123-
#' "b", 1, "x",
124-
#' "b", 3, "y",
125-
#' "b", -1, "y"
119+
#' df <- data.frame(
120+
#' x = rep(c("a", "b"), 2:3),
121+
#' y = c(1, 2, 1, 3, -1),
122+
#' grp = c("x", "y", "x", "y", "y")
126123
#' )
124+
#'
127125
#' ggplot(data = df, aes(x, y, group = grp)) +
128126
#' geom_col(aes(fill = grp), position = position_stack(reverse = TRUE)) +
129127
#' geom_hline(yintercept = 0)

R/summarise-plot.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ summarise_layout <- function(p) {
6666
l <- p$layout
6767

6868
layout <- l$layout
69-
layout <- tibble(
69+
layout <- data_frame0(
7070
panel = l$layout$PANEL,
7171
row = l$layout$ROW,
7272
col = l$layout$COL
@@ -134,7 +134,7 @@ summarise_layers <- function(p) {
134134

135135
# This currently only returns the mappings, but in the future, other
136136
# information could be added.
137-
tibble(
137+
data_frame0(
138138
mapping = layer_mappings
139139
)
140140
}

R/utilities.R

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -371,10 +371,6 @@ seq_asc <- function(to, from) {
371371
}
372372
}
373373

374-
# Needed to trigger package loading
375-
#' @importFrom tibble tibble
376-
NULL
377-
378374
# Wrapping vctrs data_frame constructor with no name repair
379375
data_frame0 <- function(...) data_frame(..., .name_repair = "minimal")
380376

man/position_stack.Rd

Lines changed: 5 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-geom-quantile.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ test_that("geom_quantile matches quantile regression", {
88

99
set.seed(6531)
1010
x <- rnorm(10)
11-
df <- tibble::tibble(
11+
df <- data_frame0(
1212
x = x,
1313
y = x^2 + 0.5 * rnorm(10)
1414
)

tests/testthat/test-geom-tile.R

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,10 @@ test_that("accepts width and height aesthetics", {
1717
geom_tile(fill = NA, colour = "black", linewidth = 1)
1818
out <- get_layer_data(p)
1919

20-
boundary <- as.data.frame(tibble::tribble(
21-
~xmin, ~xmax, ~ymin, ~ymax,
22-
-1, 1, -1, 1,
23-
-2, 2, -2, 2
24-
))
20+
boundary <- data_frame0(
21+
xmin = c(-1, -2), xmax = c(1, 2),
22+
ymin = c(-1, -2), ymax = c(1, 2)
23+
)
2524
expect_equal(out[c("xmin", "xmax", "ymin", "ymax")], boundary)
2625
})
2726

tests/testthat/test-scale-discrete.R

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
# Missing values ----------------------------------------------------------
22

3-
df <- tibble::tibble(
3+
df <- data_frame0(
44
x1 = c("a", "b", NA),
5-
x2 = factor(x1),
6-
x3 = addNA(x2),
7-
5+
x2 = factor(c("a", "b", NA)),
6+
x3 = factor(c("a", "b", NA), levels = c("a", "b", NA), exclude = NULL),
87
y = 1:3
98
)
109

tests/testthat/test-sec-axis.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ test_that("sec axis works with tidy eval", {
171171
g
172172
}
173173

174-
t <- tibble(x = letters, y = seq(10, 260, 10), z = 1:26)
174+
t <- data_frame0(x = letters, y = seq(10, 260, 10), z = 1:26)
175175

176176
p <- f(t, x, y, z)
177177

tests/testthat/test-stat-align.R

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,29 @@
11
test_that("standard alignment works", {
2-
df <- tibble::tribble(
3-
~g, ~x, ~y,
4-
"a", 1, 2,
5-
"a", 3, 5,
6-
"a", 5, 1,
7-
"b", 2, 3,
8-
"b", 4, 6,
9-
"b", 6, 7
2+
df <- data_frame0(
3+
g = rep(c("a", "b"), each = 3L),
4+
x = c(1, 3, 5, 2, 4, 6),
5+
y = c(2, 5, 1, 3, 6, 7)
106
)
117
p <- ggplot(df, aes(x, y, fill = g)) + geom_area(color = "black")
128
expect_doppelganger("align two areas", p)
139
})
1410

1511
test_that("alignment with cliffs works", {
16-
df <- tibble::tribble(
17-
~g, ~x, ~y,
18-
"a", 1, 2,
19-
"a", 3, 5,
20-
"a", 5, 1,
21-
"b", 2, 3,
22-
"b", 4, 3,
23-
"b", 4, 6,
24-
"b", 6, 7
12+
df <- data_frame0(
13+
g = rep(c("a", "b"), 3:4),
14+
x = c(1, 3, 5, 2, 4, 4, 6),
15+
y = c(2, 5, 1, 3, 3, 6, 7)
2516
)
26-
2717
p <- ggplot(df, aes(x, y, fill = g)) + geom_area(color = "black")
2818
expect_doppelganger("align two areas with cliff", p)
2919
})
3020

3121
test_that("alignment with negative and positive values works", {
32-
df <- tibble::tribble(
33-
~g, ~x, ~y,
34-
"a", 1, 1,
35-
"a", 2, 4,
36-
"a", 3, -4,
37-
"a", 8, 0,
38-
"b", 2, 4,
39-
"b", 6, -4
22+
df <- data_frame0(
23+
g = rep(c("a", "b"), c(4L, 2L)),
24+
x = c(1, 2, 3, 8, 2, 6),
25+
y = c(1, 4, -4, 0, 4, -4)
4026
)
41-
4227
p <- ggplot(df, aes(x, y, fill = g)) + geom_area(color = "black")
4328
expect_doppelganger("align two areas with pos/neg y", p)
4429
})

0 commit comments

Comments
 (0)