通过治疗来减少许多列
我有一个很大的数据集,其中包含许多列,我正在尝试找到每个处理的每一列的平均值和ST。
示例数据
治疗 | 年龄 | 经验 | 等级 | 指数 |
---|---|---|---|---|
A | 21 | 3 | 4 | 0,7 |
A | 24 | 4 | 4 | 0,5 |
B | 32 | 12 | 5 | 0,6 |
B | 54 | 23 | 3 | 0,7 |
C | 15 | 1 | 4 | 0,9 |
C | 19 | 3 | 5 | 0,4 |
我尝试过:
db%>%
group_by(treatment) %>%
summarise(mean=mean(age),sd=sd(age), .groups = "drop")
有没有办法总结所有列而不单独添加它们? (我的数据集有56列)
谢谢您的帮助
I have a large data set with many columns and I am trying to find the mean and st of each column per treatment.
Example data
treatment | age | experience | grade | index |
---|---|---|---|---|
a | 21 | 3 | 4 | 0,7 |
a | 24 | 4 | 4 | 0,5 |
b | 32 | 12 | 5 | 0,6 |
b | 54 | 23 | 3 | 0,7 |
c | 15 | 1 | 4 | 0,9 |
c | 19 | 3 | 5 | 0,4 |
I tried:
db%>%
group_by(treatment) %>%
summarise(mean=mean(age),sd=sd(age), .groups = "drop")
Is there a way to summarise all the columns without adding them individually? (my dataset has 56 columns)
Thank you for your help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)