Skip to content

Commit 0a2db27

Browse files
committed
remove tibble() from examples/tests
1 parent fd760ce commit 0a2db27

File tree

6 files changed

+26
-45
lines changed

6 files changed

+26
-45
lines changed

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)

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)