| 
4 | 4 |       case_when(FALSE ~ 1L, .default = 2:5)  | 
5 | 5 |     Condition  | 
6 | 6 |       Error in `case_when()`:  | 
7 |  | -      ! `.default` must have size 1, not size 4.  | 
 | 7 | +      ! Can't recycle `.default` (size 4) to size 1.  | 
8 | 8 | 
 
  | 
9 | 9 | # `.default` is part of common type computation  | 
10 | 10 | 
 
  | 
11 | 11 |     Code  | 
12 | 12 |       case_when(TRUE ~ 1L, .default = "x")  | 
13 | 13 |     Condition  | 
14 | 14 |       Error in `case_when()`:  | 
15 |  | -      ! Can't combine `..1 (right)` <integer> and `.default` <character>.  | 
 | 15 | +      ! Can't combine <integer> and `.default` <character>.  | 
16 | 16 | 
 
  | 
17 | 17 | # passes through `.size` correctly  | 
18 | 18 | 
 
  | 
 | 
35 | 35 |     Code  | 
36 | 36 |       case_when(1 ~ NULL)  | 
37 | 37 |     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.  | 
40 | 59 | 
 
  | 
41 | 60 | ---  | 
42 | 61 | 
 
  | 
 | 
73 | 92 |     Output  | 
74 | 93 |       <error/vctrs_error_incompatible_size>  | 
75 | 94 |       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).  | 
77 | 96 |     Code  | 
78 | 97 |       (expect_error(case_when(c(TRUE, FALSE) ~ 1, c(FALSE, TRUE, FALSE) ~ 2, c(FALSE,  | 
79 | 98 |         TRUE, FALSE, NA) ~ 3)))  | 
 | 
83 | 102 |       ! Can't recycle `..1 (left)` (size 2) to match `..2 (left)` (size 3).  | 
84 | 103 |     Code  | 
85 | 104 |       (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 | +        ```  | 
86 | 125 |     Output  | 
87 | 126 |       <error/rlang_error>  | 
88 | 127 |       Error in `case_when()`:  | 
 | 
104 | 143 |     Output  | 
105 | 144 |       <error/rlang_error>  | 
106 | 145 |       Error in `case_when()`:  | 
107 |  | -      ! At least one condition must be supplied.  | 
 | 146 | +      ! `...` can't be empty.  | 
108 | 147 |     Code  | 
109 | 148 |       (expect_error(case_when(NULL)))  | 
110 | 149 |     Output  | 
111 | 150 |       <error/rlang_error>  | 
112 | 151 |       Error in `case_when()`:  | 
113 |  | -      ! At least one condition must be supplied.  | 
 | 152 | +      ! `...` can't be empty.  | 
114 | 153 |     Code  | 
115 | 154 |       (expect_error(case_when(~ 1:2)))  | 
116 | 155 |     Output  | 
117 | 156 |       <error/rlang_error>  | 
118 | 157 |       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.  | 
120 | 159 | 
 
  | 
0 commit comments