library(fastplyr)
library(nycflights13)
# Number of flights per month, including first and last day
flights %>%
f_group_by(year, month) %>%
f_summarise(first_day = first(day),
last_day = last(day),
num_flights = n())
## Fast mean summary using `across()`
flights %>%
f_summarise(
across(where(is.double), mean),
.by = tailnum
)
# To ignore or keep NAs, use collapse::set_collapse(na.rm)
collapse::set_collapse(na.rm = FALSE)
flights %>%
f_summarise(
across(where(is.double), mean),
.by = origin
)
collapse::set_collapse(na.rm = TRUE)
Run the code above in your browser using DataLab