【问题标题】:How to make summary table by group in r? [duplicate]如何在r中按组制作汇总表? [复制]
【发布时间】:2017-11-21 08:13:41
【问题描述】:

我想在 R 中按组制作汇总表
按因素比较几个参数
例如

data(iris)
str(iris)

我想做桌子

     Group   Sepal.Length Sepal.Width Petal.Length Petal.Width
  Species1        mean       mean        mean       mean
  Species2        mean       mean        mean       mean
  Species3        mean       mean        mean       mean 

可能导入t.test结果
我该怎么办?

【问题讨论】:

    标签: r summary


    【解决方案1】:
    data(iris) 
    aggregate(iris[,1:4], list(iris$Species), mean)
    

    【讨论】:

    • 实际上我的数据集是 [ Classes 'data.table' and 'data.frame': 446 obs。 23 个变量] 数值数据是 6:23。输入上面的代码,我看到这样的错误消息“列表(df3$region)”不是函数、字符或符号..有什么问题?
    • 通过 dput(datafile) 显示您的数据片段
    • 检查名为region的非数值变量是否不在第6列和第23列之间
    猜你喜欢
    • 2021-12-26
    • 1970-01-01
    • 2019-06-01
    • 2020-10-09
    • 1970-01-01
    • 1970-01-01
    • 2017-08-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多