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()
:
In argument:
n() > 1
.
Caused by error inn()
:
! 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.