Nothing
Code
x <- list(a = 1, b = 2, c = 3)
(expect_error(select_loc(x, "a", include = 1)))
Output
<error/rlang_error>
Error in `select_loc()`:
! `include` must be a character vector.
Code
(expect_error(select_loc(x, "a", include = "d")))
Output
<error/rlang_error>
Error in `select_loc()`:
! `include` must only include variables found in `data`.
i Unknown variables: d
Code
(expect_error(select_loc(x, "a", exclude = 1)))
Output
<error/rlang_error>
Error in `select_loc()`:
! `include` must be a character vector.
Code
(expect_error(select_loc(mtcars, c(foo = cyl), allow_rename = FALSE)))
Output
<error/tidyselect:::error_disallowed_rename>
Error in `select_loc()`:
! Can't rename variables in this context.
Code
(expect_error(select_loc(mtcars, c(cyl, foo = cyl), allow_rename = FALSE)))
Output
<error/tidyselect:::error_disallowed_rename>
Error in `select_loc()`:
! Can't rename variables in this context.
Code
(expect_error(select_loc(mtcars, c(cyl, foo = mpg), allow_rename = FALSE)))
Output
<error/tidyselect:::error_disallowed_rename>
Error in `select_loc()`:
! Can't rename variables in this context.
Code
(expect_error(select_loc(mtcars, c(foo = mpg, cyl), allow_rename = FALSE)))
Output
<error/tidyselect:::error_disallowed_rename>
Error in `select_loc()`:
! Can't rename variables in this context.
Code
select_loc(mtcars, allow_empty = FALSE)
Condition
Error in `select_loc()`:
! Must select at least one item.
Code
select_loc(mtcars, integer(), allow_empty = FALSE)
Condition
Error in `select_loc()`:
! Must select at least one item.
Code
select_loc(mtcars, starts_with("z"), allow_empty = FALSE)
Condition
Error in `select_loc()`:
! Must select at least one item.
Code
(expect_error(select_loc(mtcars, f())))
Output
<error/rlang_error>
Error in `select_loc()`:
Caused by error in `f()`:
! foo
Code
(expect_error(select_loc(mtcars, function(x) "")))
Output
<error/rlang_error>
Error in `select_loc()`:
! Predicate must return `TRUE` or `FALSE`, not `""`.
Code
print(expect_error(select_loc(mtcars, f(base = TRUE))))
Output
<error/rlang_error>
Error in `select_loc()`:
i In argument: `f(base = TRUE)`.
Caused by error in `h()`:
! foo
---
Backtrace:
x
1. +-base::print(expect_error(select_loc(mtcars, f(base = TRUE))))
2. +-testthat::expect_error(select_loc(mtcars, f(base = TRUE)))
3. | \-testthat:::expect_condition_matching(...)
4. | \-testthat:::quasi_capture(...)
5. | +-testthat (local) .capture(...)
6. | | \-base::withCallingHandlers(...)
7. | \-rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
8. +-tidyselect:::select_loc(mtcars, f(base = TRUE))
9. | \-tidyselect::eval_select(...)
10. | \-tidyselect:::eval_select_impl(...)
11. | +-tidyselect:::with_subscript_errors(...)
12. | | \-base::withCallingHandlers(...)
13. | \-tidyselect:::vars_select_eval(...)
14. | \-tidyselect:::walk_data_tree(expr, data_mask, context_mask)
15. | \-tidyselect:::eval_context(expr, context_mask, call = error_call)
16. | +-tidyselect:::with_chained_errors(...)
17. | | \-base::withCallingHandlers(...)
18. | \-rlang::eval_tidy(as_quosure(expr, env), context_mask)
19. \-tidyselect (local) f(base = TRUE)
20. \-tidyselect (local) g(base)
21. \-tidyselect (local) h(base)
22. \-base::stop("foo")
Code
print(expect_error(select_loc(mtcars, f(base = FALSE))))
Output
<error/rlang_error>
Error in `select_loc()`:
i In argument: `f(base = FALSE)`.
Caused by error in `h()`:
! foo
---
Backtrace:
x
1. +-base::print(expect_error(select_loc(mtcars, f(base = FALSE))))
2. +-testthat::expect_error(select_loc(mtcars, f(base = FALSE)))
3. | \-testthat:::expect_condition_matching(...)
4. | \-testthat:::quasi_capture(...)
5. | +-testthat (local) .capture(...)
6. | | \-base::withCallingHandlers(...)
7. | \-rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
8. +-tidyselect:::select_loc(mtcars, f(base = FALSE))
9. | \-tidyselect::eval_select(...)
10. | \-tidyselect:::eval_select_impl(...)
11. | +-tidyselect:::with_subscript_errors(...)
12. | | \-base::withCallingHandlers(...)
13. | \-tidyselect:::vars_select_eval(...)
14. | \-tidyselect:::walk_data_tree(expr, data_mask, context_mask)
15. | \-tidyselect:::eval_context(expr, context_mask, call = error_call)
16. | +-tidyselect:::with_chained_errors(...)
17. | | \-base::withCallingHandlers(...)
18. | \-rlang::eval_tidy(as_quosure(expr, env), context_mask)
19. \-tidyselect (local) f(base = FALSE)
20. \-tidyselect (local) g(base)
21. \-tidyselect (local) h(base)
Code
(expect_error(select_loc(mtcars, 1 + "")))
Output
<error/rlang_error>
Error in `select_loc()`:
i In argument: `1 + ""`.
Caused by error in `1 + ""`:
! non-numeric argument to binary operator
Code
f <- (function() 1 + "")
(expect_error(select_loc(mtcars, f())))
Output
<error/rlang_error>
Error in `select_loc()`:
i In argument: `f()`.
Caused by error in `1 + ""`:
! non-numeric argument to binary operator
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.