Closed
Description
Following the Twitter conversation from here.
As utils::select.list()
is registered as an S3, calling dplyr::select()
on a list calls select.list()
without informing the user, who is faced with an interactive prompt asking them to do a selection. As far as I have understood this behavior is not intended.
I think this misuse can arise if you intend to write map_df() %>% select()
and you end up writing map() %>% select()
.
Here's a suggested solution:
- having a message to the user that they are redirected to
utils::select.list()
#' @export
select.list <- function(.data, ...) {
message("Calling `select()` on a list, redirecting to `utils::select.list()`")
utils::select.list(choices = .data)
}
> list(a = 12) %>% dplyr::select()
Calling `select()` on a list, redirecting to `utils::select.list()`
1: 12
Selection: 1
$a
[1] 12
> list(a = 12) %>% utils::select.list()
1: 12
Selection: 1
$a
[1] 12
Note: related to #2817
Metadata
Metadata
Assignees
Labels
No labels