This question is linked to this one but I cannot get it to work when I want to use multiple functions. I have a function as follows:
f3 <- function(x){
d <- mtcars %>% group_by(cyl, gear) %>% summarize(across(all_of(x),
m = mean(x),
sd = sd(x),
n = length(x),
se = sd / sqrt(n),
tscore = qt(0.975, n-1),
margin = tscore * se,
uppma = mean + margin,
lowma = mean - margin),
.groups = 'drop')
}
But when I call the function like this it doesn't work:
d <- f3(x = c('wt'))
My required output is df with columns called m, sd, n, se, tscore, margin, uppma, lowma
with the result of that function across the groups I made with group_by()