Debian Codegraph @

tests/testthat/_snaps/helpers-vector.md

raw symbols SCIP
1 # `all_of()` fails even if `.strict` is FALSE
2
3 Code
4 select_loc(letters2, all_of(c("a", "bar", "c")), strict = FALSE)
5 Condition
6 Error in `select_loc()`:
7 i In argument: `all_of(c("a", "bar", "c"))`.
8 Caused by error in `all_of()`:
9 ! Can't subset elements that don't exist.
10 x Element `bar` doesn't exist.
11
12 # all_of() and any_of() check their inputs
13
14 Code
15 (expect_error(select_loc(letters2, all_of(NA))))
16 Output
17 <error/rlang_error>
18 Error in `select_loc()`:
19 ! Selections can't have missing values.
20 Code
21 (expect_error(select_loc(letters2, any_of(NA))))
22 Output
23 <error/rlang_error>
24 Error in `select_loc()`:
25 ! Selections can't have missing values.
26 Code
27 (expect_error(select_loc(letters2, all_of(TRUE))))
28 Output
29 <error/rlang_error>
30 Error in `select_loc()`:
31 i In argument: `all_of(TRUE)`.
32 Caused by error in `all_of()`:
33 ! Can't subset elements.
34 x Subscript must be numeric or character, not `TRUE`.
35 Code
36 (expect_error(select_loc(letters2, any_of(TRUE))))
37 Output
38 <error/rlang_error>
39 Error in `select_loc()`:
40 i In argument: `any_of(TRUE)`.
41 Caused by error in `any_of()`:
42 ! Can't subset elements.
43 x Subscript must be numeric or character, not `TRUE`.
44 Code
45 (expect_error(select_loc(letters2, any_of(is.factor))))
46 Output
47 <error/rlang_error>
48 Error in `select_loc()`:
49 i In argument: `any_of(is.factor)`.
50 Caused by error in `any_of()`:
51 ! Can't subset elements.
52 x Subscript must be numeric or character, not a function.
53 Code
54 (expect_error(select_loc(letters2, all_of(is.factor))))
55 Output
56 <error/rlang_error>
57 Error in `select_loc()`:
58 i In argument: `all_of(is.factor)`.
59 Caused by error in `all_of()`:
60 ! Can't subset elements.
61 x Subscript must be numeric or character, not a function.
62
63 # any_of() errors out of context
64
65 Code
66 (expect_error(any_of()))
67 Output
68 <error/rlang_error>
69 Error:
70 ! `any_of()` must be used within a *selecting* function.
71 i See <https://tidyselect.r-lib.org/reference/faq-selection-context.html> for details.
72
73 # all_of() is deprecated out of context (#269)
74
75 Code
76 out <- all_of("x")
77 Condition
78 Warning:
79 Using `all_of()` outside of a selecting function was deprecated in tidyselect 1.2.0.
80 i See details at <https://tidyselect.r-lib.org/reference/faq-selection-context.html>
81
82 # any_of generates informative error if ... not empty
83
84 Code
85 any_of("b", "c", "d")
86 Condition
87 Error in `any_of()`:
88 ! `...` must be empty.
89 i Did you forget `c()`?
90 i The expected syntax is `any_of(c("a", "b"))`, not `any_of("a", "b")`
91