Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

distinct not working with lists #773

Closed
luispfonseca opened this issue Oct 20, 2023 · 2 comments · Fixed by #774
Closed

distinct not working with lists #773

luispfonseca opened this issue Oct 20, 2023 · 2 comments · Fixed by #774
Labels
feature feature

Comments

@luispfonseca
Copy link

luispfonseca commented Oct 20, 2023

See reprex below. Possible context in Rdatatable/data.table#3332

library(grid)
library(ggplotify)

p1 <- as.grob(~barplot(1:10))

library(tidytable)
#> 
#> Attaching package: 'tidytable'
#> The following objects are masked from 'package:stats':
#> 
#>     dt, filter, lag
#> The following object is masked from 'package:base':
#> 
#>     %in%

tidytable(
  a = rep(1,2),
  grob = rep(list(p1), 2)
) %>% 
  distinct(a, grob)
#> Error in forderv(x, by = by, sort = FALSE, retGrp = TRUE): Column 2 passed to [f]order is type 'list', not yet supported.

Created on 2023-10-20 with reprex v2.0.2

@luispfonseca
Copy link
Author

Just to confirm, it works with dplyr:

library(grid)
library(ggplotify)

p1 <- as.grob(~barplot(1:10))

library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union

tibble(
  a = rep(1, 2),
  grob = rep(list(p1), 2)
) %>% 
  distinct(a, grob)
#> # A tibble: 1 × 2
#>       a grob   
#>   <dbl> <list> 
#> 1     1 <gTree>

Created on 2023-10-20 with reprex v2.0.2

@markfairbanks
Copy link
Owner

All set - thanks for catching this!

# install.packages("pak")
# pak::pak("markfairbanks/tidytable")
library(tidytable)

df <- tidytable(x = 1, l = list(1, 1))

distinct(df)
#> # A tidytable: 1 × 2
#>       x l        
#>   <dbl> <list>   
#> 1     1 <dbl [1]>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants