Code
res <- select(df, x)
Message
Adding missing grouping variables: `g`
Code
expect_equal(df %>% select(a = c), tibble(b = 2, a = 3) %>% group_by(b))
Message
Adding missing grouping variables: `b`
Code
expect_equal(df %>% select(b = c), tibble(a = 1, b = 3) %>% group_by(a))
Message
Adding missing grouping variables: `a`
Code
df <- tibble(`a b` = 1L) %>% group_by(`a b`) %>% select()
Message
Adding missing grouping variables: `a b`
Code
(expect_error(select(mtcars, 1 + "")))
Output
<error/rlang_error>
Error in `select()`:
i In argument: `1 + ""`.
Caused by error in `1 + ""`:
! non-numeric argument to binary operator
[
implementation is brokenCode
(expect_error(select(df1, 1:2)))
Output
<error/vctrs_error_subscript_oob>
Error in `select()`:
! Can't select columns past the end.
i Location 2 doesn't exist.
i There is only 1 column.
Code
(expect_error(select(df1, 0)))
Output
<error/rlang_error>
Error in `select()`:
! Can't reconstruct data frame.
x The `[` method for class <dplyr_test_broken_operator/tbl_df/tbl/data.frame> must return a data frame.
i It returned a <list>.
Code
(expect_error(select(df1, 2)))
Output
<error/vctrs_error_subscript_oob>
Error in `select()`:
! Can't select columns past the end.
i Location 2 doesn't exist.
i There is only 1 column.
Code
(expect_error(select(df1, 1)))
Output
<error/rlang_error>
Error in `select()`:
! Can't reconstruct data frame.
x The `[` method for class <dplyr_test_broken_operator/tbl_df/tbl/data.frame> must return a data frame.
i It returned a <list>.
Code
(expect_error(select(df2, 1)))
Output
<error/rlang_error>
Error in `select()`:
! Can't reconstruct data frame.
x The `[` method for class <dplyr_test_operator_wrong_size/tbl_df/tbl/data.frame> must return a data frame with 1 column.
i It returned a <data.frame> of 0 columns.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.