Getting mean and standard deviation from groups in a data.frame

后端 未结 2 1198
野的像风
野的像风 2021-01-17 01:07

I have heart rate data in the form of a list with the four categories 1AS, 1CS, 1AI, 1CI each of variable size. I would like to output mean and standard deviations for each

2条回答
  •  南笙
    南笙 (楼主)
    2021-01-17 01:10

    Another solution using ave:

    ave(DF$HR, DF$Group)
    

    gives the mean and

    ave(DF$HR, DF$Group, FUN=sd)
    

    with DF being your data frame.

提交回复
热议问题