Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要找到变量的平均值以及特定组合在 r 中的平均值出现的次数。
在示例中,我按 variables 分组cli,cus并且ron需要总结以找到该组合的平均值age和频率cash:
cli
cus
ron
age
cash
df%>% group_by(.dots=c("cli","cus","ron")) %>% summarise_all(mean(age),length(cash))
这不起作用;还有其他出路吗?
可能只是我,因为我似乎把这个复杂化了,总结一下就能得到我需要的东西 df%>% group_by(.dots=c("cli","cus","ron")) %> % 总结(平均(年龄),长度(现金))