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
Using a function inside summarise() that returns a data.frame doesn't seem to be supported:
library(dplyr, warn.conflicts=FALSE)
library(dtplyr)
# example from ?summarisemy_quantile<-function(x, probs) {
tibble(x= quantile(x, probs), probs=probs)
}
mtcars %>%
group_by(cyl) %>%
summarise(my_quantile(disp, c(0.25, 0.75)))
#> `summarise()` has grouped output by 'cyl'. You can override using the `.groups`#> argument.#> # A tibble: 6 × 3#> # Groups: cyl [3]#> cyl x probs#> <dbl> <dbl> <dbl>#> 1 4 78.8 0.25#> 2 4 121. 0.75#> 3 6 160 0.25#> 4 6 196. 0.75#> 5 8 302. 0.25#> 6 8 390 0.75mtcars %>%
lazy_dt() |>
group_by(cyl) %>%
summarise(my_quantile(disp, c(0.25, 0.75))) |>
collect()
#> Error in `[.data.table`(`_DT1`, , .(`my_quantile(disp, c(0.25, 0.75))` = my_quantile(disp, : All items in j=list(...) should be atomic vectors or lists. If you are trying something like j=list(.SD,newcol=mean(colA)) then use := by group instead (much quicker), or cbind or merge afterwards.
Using a function inside
summarise()
that returns adata.frame
doesn't seem to be supported:Created on 2023-01-05 with reprex v2.0.2
The text was updated successfully, but these errors were encountered: