You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed that n_distinct(mylist) gives a different value than length(unique(mylist)) when mylist is a list of lists. This might be a bug?
I think this is a duplicate of #3699 and therefore also #2355, but those discussions are closed and marked as fixed.
library(dplyr)
(mylist<- c(list(1L), list(1L)))
#> [[1]]#> [1] 1#> #> [[2]]#> [1] 1
identical(mylist[1], mylist[2])
#> [1] TRUE
length(unique(mylist))
#> [1] 1
n_distinct(mylist)
#> [1] 2# The behavior is the same if we're using a list column in a tibble.
tibble(l=mylist) %>% mutate(n= n_distinct(l))
#> # A tibble: 2 x 2#> l n#> <list> <int>#> 1 <int [1]> 2#> 2 <int [1]> 2
Using dplyr v0.8.5, rlang 0.4.5, and vctrs 0.2.4.
The text was updated successfully, but these errors were encountered:
This appears to be fixed in the development version, soon to be released as 1.0.0
library(dplyr, warn.conflicts=FALSE)
(mylist<- c(list(1L), list(1L)))
#> [[1]]#> [1] 1#> #> [[2]]#> [1] 1
identical(mylist[1], mylist[2])
#> [1] TRUE
length(unique(mylist))
#> [1] 1
n_distinct(mylist)
#> [1] 1# The behavior is the same if we're using a list column in a tibble.
tibble(l=mylist) %>%
mutate(n= n_distinct(l))
#> # A tibble: 2 x 2#> l n#> <list> <int>#> 1 <int [1]> 1#> 2 <int [1]> 1
I noticed that
n_distinct(mylist)
gives a different value thanlength(unique(mylist))
whenmylist
is a list of lists. This might be a bug?I think this is a duplicate of #3699 and therefore also #2355, but those discussions are closed and marked as fixed.
Using dplyr v0.8.5, rlang 0.4.5, and vctrs 0.2.4.
The text was updated successfully, but these errors were encountered: