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

0 commit comments

Comments
 (0)