Learning r, pipes, and the new style to replace summarise_at using across, and have this from online examples https://cran.r-project.org/web/packages/dplyr/vignettes/colwise.html which runs fine:
customstats1 <- list(
min = ~min(.x, na.rm = TRUE),
max = ~max(.x, na.rm = TRUE)
)
newdf4 <- mytibble %>%
group_by(color) %>%
summarise(across(col1:col3, customstats1))
color col1_min col1_max col2_min col2_max col3_min col3_max
1 1 1 2 2 3 3 4
2 2 11 11.5 12 12.5 13 13.8
But, can I use other functions instead of the base r stat functions e.g. mean or min?, and what would be the syntax to use?
As an example:
descr() is so commonly used on simpler data sets and is handy to me as it includes skew and kurtosis, lots of other estimators and useful column headings; what would be the trick with grouped data as seen above?
I'd like summarytools::descr(some_df, stats = ("all")) my initial experiments failed, mostly citing incomplete . If I use descr after group_by with no summarise it hangs up.
I realize that in part I am unclear how to use this type of function within pipes, and the answer may involve that, in part.
Thanks.