Here is an example of what I'm trying to achieve:
df <- data.frame(label = c(rep("ABC", 5), rep("CDE", 5), rep("FGH", 5)), x = runif(15, 0, 100))
df %>% group_by(label) %>%
summarise(across(everything(), list(lessthan_10 = ~sum(. < 10), lessthan_20 = ~sum(. < 20), lessthan_30 = ~sum(. < 20), lessthan_40 = ~sum(. < 40))))
In this case, I'm calculating 4 different columns in the summary (counting the entries less than 10, less than 20, less than 30, and less than 40). In reality, I would like to calculate 100 different columns using a custom function that takes in x and 100 different parameters. Is there a way to do this using a loop or a list without writing out every single column I want to calculate?