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
across is normally able to accept a list of functions which will all be applied to the selected columns. This works in dtplyr if the list is supplied directly in across, but not if it's stored as a variable and substituted in.
library(dplyr)
df<-data.table::data.table(
x= seq(1, 10)
)
# Store list of summary functions as a variablesummaries<-list(
"Mean"=mean,
"SD"=sd
)
# Throws an error that summaries is not a functiondf|>dtplyr::lazy_dt() |>
summarise(across("x", summaries)) |>data.table::as.data.table()
# Works fine if not a lazy data tabledf|>
summarise(across("x", summaries)) |>data.table::as.data.table()
# Also works fine if the list is written within the calldf|>dtplyr::lazy_dt() |>
summarise(across("x", list("Mean"=mean, "SD"=sd))) |>data.table::as.data.table()
The text was updated successfully, but these errors were encountered:
across
is normally able to accept a list of functions which will all be applied to the selected columns. This works indtplyr
if the list is supplied directly in across, but not if it's stored as a variable and substituted in.The text was updated successfully, but these errors were encountered: