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
In the Arguments section of help(dtplyr::summarise.dtplyr_step), the "dots" argument is explained in a similar way to dplyr::summarise():
... <data-masking> Name-value pairs of summary functions. The name will be the name of the variable in the result. The value can be:
A vector of length 1, e.g. min(x), n(), or sum(is.na(y)).
A data frame, to add multiple columns from a single expression.
However, using a data frame within ... fails when summarising lazy_dt objects. The error message suggests that {data.table} is being asked to create a single column containing the entire data frame object, rather than multiple columns based on the columns of the data frame.
# tibble - works as expectedmtcars|>dplyr::summarise(
stats::quantile(mpg, probs= c(0.5, 0.9)) |>tibble::as_tibble_row(),
.by=cyl
)
#> cyl 50% 90%#> 1 6 19.7 21.16#> 2 4 26.0 32.40#> 3 8 15.2 18.28# lazy_dt - error when constructing `j`mtcars|>dtplyr::lazy_dt() |>dplyr::summarise(
stats::quantile(mpg, probs= c(0.5, 0.9)) |>tibble::as_tibble_row(),
.by=cyl
)
#> Error in `[.data.table`(`_DT1`, , .(`tibble::as_tibble_row(stats::quantile(mpg, probs = c(0.5, 0.9)))` = tibble::as_tibble_row(stats::quantile(mpg, : 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.
In the Arguments section of
help(dtplyr::summarise.dtplyr_step)
, the "dots" argument is explained in a similar way todplyr::summarise()
:However, using a data frame within
...
fails when summarisinglazy_dt
objects. The error message suggests that {data.table} is being asked to create a single column containing the entire data frame object, rather than multiple columns based on the columns of the data frame.Created on 2023-11-02 with reprex v2.0.2
Session info
The text was updated successfully, but these errors were encountered: