Skip to content

Commit ed84aaf

Browse files
krlmlrgithub-actions[bot]
authored andcommitted
[create-pull-request] automated change
1 parent 1b11262 commit ed84aaf

13 files changed

+70
-91
lines changed

tests/testthat/_snaps/dplyr-case-match.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@
44
case_match(1)
55
Condition
66
Error in `case_match()`:
7-
! At least one condition must be supplied.
7+
! `...` can't be empty.
88

99
---
1010

1111
Code
1212
case_match(1, NULL)
1313
Condition
1414
Error in `case_match()`:
15-
! At least one condition must be supplied.
15+
! `...` can't be empty.
1616

1717
# `.default` is part of common type computation
1818

1919
Code
2020
case_match(1, 1 ~ 1L, .default = "x")
2121
Condition
2222
Error in `case_match()`:
23-
! Can't combine `..1 (right)` <integer> and `.default` <character>.
23+
! Can't combine <integer> and `.default` <character>.
2424

2525
# `NULL` formula element throws meaningful error
2626

@@ -29,6 +29,7 @@
2929
Condition
3030
Error in `case_match()`:
3131
! `..1 (right)` must be a vector, not `NULL`.
32+
i Read our FAQ about scalar types (`?vctrs::faq_error_scalar_type`) to learn more.
3233

3334
---
3435

@@ -37,6 +38,7 @@
3738
Condition
3839
Error in `case_match()`:
3940
! `..1 (left)` must be a vector, not `NULL`.
41+
i Read our FAQ about scalar types (`?vctrs::faq_error_scalar_type`) to learn more.
4042

4143
# throws chained errors when formula evaluation fails
4244

tests/testthat/_snaps/dplyr-case-when.md

Lines changed: 47 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
case_when(FALSE ~ 1L, .default = 2:5)
55
Condition
66
Error in `case_when()`:
7-
! `.default` must have size 1, not size 4.
7+
! Can't recycle `.default` (size 4) to size 1.
88

99
# `.default` is part of common type computation
1010

1111
Code
1212
case_when(TRUE ~ 1L, .default = "x")
1313
Condition
1414
Error in `case_when()`:
15-
! Can't combine `..1 (right)` <integer> and `.default` <character>.
15+
! Can't combine <integer> and `.default` <character>.
1616

1717
# passes through `.size` correctly
1818

@@ -35,8 +35,27 @@
3535
Code
3636
case_when(1 ~ NULL)
3737
Condition
38-
Error in `case_when()`:
39-
! `..1 (right)` must be a vector, not `NULL`.
38+
Warning:
39+
Calling `case_when()` with size 1 LHS inputs and size >1 RHS inputs was deprecated in dplyr 1.2.0.
40+
i This `case_when()` statement can result in subtle silent bugs and is very inefficient.
41+
42+
Please use a series of if statements instead:
43+
44+
```
45+
# Previously
46+
case_when(scalar_lhs1 ~ rhs1, scalar_lhs2 ~ rhs2, .default = default)
47+
48+
# Now
49+
if (scalar_lhs1) {
50+
rhs1
51+
} else if (scalar_lhs2) {
52+
rhs2
53+
} else {
54+
default
55+
}
56+
```
57+
Error in `case_when()`:
58+
! `..1 (left)` must be a logical vector, not an empty numeric vector.
4059

4160
---
4261

@@ -73,7 +92,7 @@
7392
Output
7493
<error/vctrs_error_incompatible_size>
7594
Error in `case_when()`:
76-
! Can't recycle `..1 (left)` (size 2) to match `..1 (right)` (size 3).
95+
! Can't recycle `..1 (right)` (size 3) to match `..2 (right)` (size 2).
7796
Code
7897
(expect_error(case_when(c(TRUE, FALSE) ~ 1, c(FALSE, TRUE, FALSE) ~ 2, c(FALSE,
7998
TRUE, FALSE, NA) ~ 3)))
@@ -83,6 +102,26 @@
83102
! Can't recycle `..1 (left)` (size 2) to match `..2 (left)` (size 3).
84103
Code
85104
(expect_error(case_when(50 ~ 1:3)))
105+
Condition
106+
Warning:
107+
Calling `case_when()` with size 1 LHS inputs and size >1 RHS inputs was deprecated in dplyr 1.2.0.
108+
i This `case_when()` statement can result in subtle silent bugs and is very inefficient.
109+
110+
Please use a series of if statements instead:
111+
112+
```
113+
# Previously
114+
case_when(scalar_lhs1 ~ rhs1, scalar_lhs2 ~ rhs2, .default = default)
115+
116+
# Now
117+
if (scalar_lhs1) {
118+
rhs1
119+
} else if (scalar_lhs2) {
120+
rhs2
121+
} else {
122+
default
123+
}
124+
```
86125
Output
87126
<error/rlang_error>
88127
Error in `case_when()`:
@@ -104,17 +143,17 @@
104143
Output
105144
<error/rlang_error>
106145
Error in `case_when()`:
107-
! At least one condition must be supplied.
146+
! `...` can't be empty.
108147
Code
109148
(expect_error(case_when(NULL)))
110149
Output
111150
<error/rlang_error>
112151
Error in `case_when()`:
113-
! At least one condition must be supplied.
152+
! `...` can't be empty.
114153
Code
115154
(expect_error(case_when(~ 1:2)))
116155
Output
117156
<error/rlang_error>
118157
Error in `case_when()`:
119-
! Case 1 (`~1:2`) must be a two-sided formula.
158+
! Case 1 (`~1:2`) must be a two-sided formula, not a one-sided formula.
120159

tests/testthat/_snaps/dplyr-coalesce.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
coalesce(NULL, NULL)
3636
Condition
3737
Error in `coalesce()`:
38-
! `...` can't be empty.
38+
! `...` must contain at least 1 non-`NULL` value.
3939

4040
# inputs must be vectors
4141

@@ -44,6 +44,7 @@
4444
Condition
4545
Error in `coalesce()`:
4646
! `..2` must be a vector, not an environment.
47+
i Read our FAQ about scalar types (`?vctrs::faq_error_scalar_type`) to learn more.
4748

4849
# names in error messages are indexed correctly
4950

tests/testthat/_snaps/dplyr-consecutive-id.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@
2020
Condition
2121
Error in `consecutive_id()`:
2222
! `..1` must be a vector, not a function.
23+
i Read our FAQ about scalar types (`?vctrs::faq_error_scalar_type`) to learn more.
2324

tests/testthat/_snaps/dplyr-count-tally.md

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,6 @@
1414
Error in `count()`:
1515
! `name` must be a single string, not a character vector.
1616

17-
# can only explicitly chain together multiple tallies
18-
19-
Code
20-
df <- data.frame(g = c(1, 1, 2, 2), n = 1:4)
21-
df %>% duckplyr_count(g, wt = n)
22-
Output
23-
g n
24-
1 1 3
25-
2 2 7
26-
Code
27-
df %>% duckplyr_count(g, wt = n) %>% duckplyr_count(wt = n)
28-
Output
29-
n
30-
1 10
31-
Code
32-
df %>% duckplyr_count(n)
33-
Message
34-
Storing counts in `nn`, as `n` already present in input
35-
i Use `name = "new_name"` to pick a new name.
36-
Output
37-
n nn
38-
1 1 1
39-
2 2 1
40-
3 3 1
41-
4 4 1
42-
4317
# duckplyr_count() owns errors (#6139)
4418

4519
Code
@@ -55,7 +29,7 @@
5529
Output
5630
<error/rlang_error>
5731
Error in `summarise()`:
58-
i In argument: `n = sum(1 + "", na.rm = TRUE)`.
32+
i In argument: `n = base::sum(1 + "", na.rm = TRUE)`.
5933
Caused by error in `1 + ""`:
6034
! non-numeric argument to binary operator
6135

@@ -66,7 +40,7 @@
6640
Output
6741
<error/rlang_error>
6842
Error in `tally()`:
69-
i In argument: `n = sum(1 + "", na.rm = TRUE)`.
43+
i In argument: `n = base::sum(1 + "", na.rm = TRUE)`.
7044
Caused by error in `1 + ""`:
7145
! non-numeric argument to binary operator
7246

@@ -85,7 +59,7 @@
8559
Output
8660
<error/dplyr:::mutate_error>
8761
Error in `mutate()`:
88-
i In argument: `n = sum(1 + "", na.rm = TRUE)`.
62+
i In argument: `n = base::sum(1 + "", na.rm = TRUE)`.
8963
Caused by error in `1 + ""`:
9064
! non-numeric argument to binary operator
9165

@@ -96,7 +70,7 @@
9670
Output
9771
<error/dplyr:::mutate_error>
9872
Error in `add_tally()`:
99-
i In argument: `n = sum(1 + "", na.rm = TRUE)`.
73+
i In argument: `n = base::sum(1 + "", na.rm = TRUE)`.
10074
Caused by error in `1 + ""`:
10175
! non-numeric argument to binary operator
10276

tests/testthat/_snaps/dplyr-desc.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55
Condition
66
Error in `desc()`:
77
! `x` must be a vector, not a function.
8+
i Read our FAQ about scalar types (`?vctrs::faq_error_scalar_type`) to learn more.
89

tests/testthat/_snaps/dplyr-if-else.md

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,23 @@
2828
if_else(x < 2, bad, x)
2929
Condition
3030
Error in `if_else()`:
31-
! `true` must have size 3, not size 2.
31+
! Can't recycle `true` (size 2) to size 3.
3232

3333
---
3434

3535
Code
3636
if_else(x < 2, x, bad)
3737
Condition
3838
Error in `if_else()`:
39-
! `false` must have size 3, not size 2.
39+
! Can't recycle `false` (size 2) to size 3.
4040

4141
---
4242

4343
Code
4444
if_else(x < 2, x, x, missing = bad)
4545
Condition
4646
Error in `if_else()`:
47-
! `missing` must have size 3, not size 2.
47+
! Can't recycle `missing` (size 2) to size 3.
4848

4949
# must have empty dots
5050

@@ -66,11 +66,3 @@
6666
! Can't convert from `false` <double> to <integer> due to loss of precision.
6767
* Locations: 1
6868

69-
# `size` overrides the `condition` size
70-
71-
Code
72-
if_else(TRUE, 1, 2, size = 2)
73-
Condition
74-
Error in `if_else()`:
75-
! `condition` must have size 2, not size 1.
76-

tests/testthat/_snaps/dplyr-join-rows.md

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -319,39 +319,11 @@
319319
i 50000005000000 rows would be returned. 2147483647 rows is the maximum number allowed.
320320
i Double check your join keys. This error commonly occurs due to a missing join key, or an improperly specified join condition.
321321

322-
# `multiple = NULL` is deprecated and results in `'all'` (#6731)
323-
324-
Code
325-
out <- join_rows(df1, df2, multiple = NULL)
326-
Condition
327-
Warning:
328-
Specifying `multiple = NULL` was deprecated in dplyr 1.1.1.
329-
i Please use `multiple = "all"` instead.
330-
331-
---
332-
333-
Code
334-
duckplyr_left_join(df1, df2, by = join_by(x), multiple = NULL)
335-
Condition
336-
Warning:
337-
Specifying `multiple = NULL` was deprecated in dplyr 1.1.1.
338-
i Please use `multiple = "all"` instead.
339-
Output
340-
# A tibble: 3 x 1
341-
x
342-
<dbl>
343-
1 1
344-
2 2
345-
3 2
346-
347322
# `multiple = 'error'` is deprecated (#6731)
348323

349324
Code
350325
join_rows(df1, df2, multiple = "error")
351326
Condition
352-
Warning:
353-
Specifying `multiple = "error"` was deprecated in dplyr 1.1.1.
354-
i Please use `relationship = "many-to-one"` instead.
355327
Error:
356328
! Each row in `x` must match at most 1 row in `y`.
357329
i Row 2 of `x` matches multiple rows in `y`.
@@ -361,9 +333,6 @@
361333
Code
362334
duckplyr_left_join(df1, df2, by = join_by(x), multiple = "error")
363335
Condition
364-
Warning:
365-
Specifying `multiple = "error"` was deprecated in dplyr 1.1.1.
366-
i Please use `relationship = "many-to-one"` instead.
367336
Error in `left_join()`:
368337
! Each row in `x` must match at most 1 row in `y`.
369338
i Row 2 of `x` matches multiple rows in `y`.
@@ -373,9 +342,6 @@
373342
Code
374343
out <- join_rows(df1, df2, multiple = "warning")
375344
Condition
376-
Warning:
377-
Specifying `multiple = "warning"` was deprecated in dplyr 1.1.1.
378-
i Please use `relationship = "many-to-one"` instead.
379345
Warning:
380346
Each row in `x` is expected to match at most 1 row in `y`.
381347
i Row 2 of `x` matches multiple rows.
@@ -385,9 +351,6 @@
385351
Code
386352
duckplyr_left_join(df1, df2, by = join_by(x), multiple = "warning")
387353
Condition
388-
Warning:
389-
Specifying `multiple = "warning"` was deprecated in dplyr 1.1.1.
390-
i Please use `relationship = "many-to-one"` instead.
391354
Warning in `left_join()`:
392355
Each row in `x` is expected to match at most 1 row in `y`.
393356
i Row 2 of `x` matches multiple rows.

tests/testthat/_snaps/dplyr-lead-lag.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
Condition
6060
Error in `lead()`:
6161
! `x` must be a vector, not an environment.
62+
i Read our FAQ about scalar types (`?vctrs::faq_error_scalar_type`) to learn more.
6263

6364
---
6465

@@ -67,4 +68,5 @@
6768
Condition
6869
Error in `lag()`:
6970
! `x` must be a vector, not an environment.
71+
i Read our FAQ about scalar types (`?vctrs::faq_error_scalar_type`) to learn more.
7072

tests/testthat/_snaps/dplyr-n-distinct.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@
1717
Condition
1818
Error in `n_distinct()`:
1919
! `..1` must be a vector, not a function.
20+
i Read our FAQ about scalar types (`?vctrs::faq_error_scalar_type`) to learn more.
2021

0 commit comments

Comments
 (0)