tidyverse / dtplyr

Data table backend for dplyr
https://dtplyr.tidyverse.org
Other
670 stars 57 forks source link

`separate` errors when multiple columns provided as `col` #361

Closed eutwt closed 2 years ago

eutwt commented 2 years ago

Using vars_pull as in tidyr to get the same error. Prior to this PR the behavior was to select the first of the columns provided.

library(tidyr, warn.conflicts = FALSE)
library(data.table, warn.conflicts = FALSE)
devtools::load_all("/Users/mbp/Documents/GitHub/dtp")
#> ℹ Loading dtplyr
#> Warning: package 'dplyr' was built under R version 4.1.2

dt <- lazy_dt(tibble(x = c("a_a", "b_b", "c_c"), y = x))

dt %>% 
  separate(c(x, y), into = c("left", "right")) 
#> Error in `pull_as_location2()`:
#> ! Must extract column with a single valid subscript.
#> ✖ Subscript `var` has size 2 but must be size 1.
dt %>% 
  as_tibble() %>% 
  separate(c(x, y), into = c("left", "right")) 
#> Error in `pull_as_location2()`:
#> ! Must extract column with a single valid subscript.
#> ✖ Subscript `var` has size 2 but must be size 1.

Created on 2022-06-17 by the reprex package (v2.0.1)

markfairbanks commented 2 years ago

Good catch 👍