Why is dfidx::filter() prefered over tidytable::filter()?

I hope tidytable questions belong here. My table has over a million rows and I decided to switch from dplyr/tidyr to tidytable. Unfortunately, this gives strange results when I combine filter() and n(). It worked perfectly fine using dataframes and dplyr, albeit slow.

library(tidytable)

df1 <- data.frame(a = 1:6,
                  b = c(1, 1, 1, 1, 2, 3))
td1 <- as_tidytable(df1)
td1 |>
  group_by(b) |>
  filter(n() > 1) |>
  ungroup()

This gives the following error:

Error in filter():
:information_source: In argument: n() > 1.
Caused by error in n():
! n() should only be used inside tidytable verbs

I used NCmisc::list.functions.in.file() and found that dfidx::filter() is prefered over tidytable::filter(). I managed to make it work by adding this on the second line:

conflicted::conflict_prefer_all(winner = "tidytable")

Can someone please explain to me what is going on? Why is the package dfidx prefered even though I never loaded it? This gives me an unsettling feeling that I am making other mistakes in tidytable.

I can't replicate this issue.

library(tidytable)
#> Warning: package 'tidytable' was built under R version 4.4.3
#> 
#> Attaching package: 'tidytable'
#> The following objects are masked from 'package:stats':
#> 
#>     dt, filter, lag
#> The following object is masked from 'package:base':
#> 
#>     %in%

df1 <- data.frame(a = 1:6,
                  b = c(1, 1, 1, 1, 2, 3))
td1 <- as_tidytable(df1)
td1 |>
  group_by(b) |>
  filter(n() > 1) |>
  ungroup()
#> # A tidytable: 4 × 2
#>       a     b
#>   <int> <dbl>
#> 1     1     1
#> 2     2     1
#> 3     3     1
#> 4     4     1

Created on 2025-04-07 with reprex v2.1.1

Nor can I.

Kikkervelf
Is there a change you have something in your environment that is interfering?Perhaps a conflict between two packages.

Thank you for your replies. I don't get the error message anymore and don't know what went wrong, but at least it's gone now.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.