假设您的数据位于名为的 data.frame 中DF
:
by(DF$HR,DF$Group,mean)
# DF$Group: 1AI
# [1] 276
# -------------------------------------------------------------------------------------------------------------------------------------------------------------
# DF$Group: 1AS
# [1] 246.7692
# -------------------------------------------------------------------------------------------------------------------------------------------------------------
# DF$Group: 1CI
# [1] 217.625
# -------------------------------------------------------------------------------------------------------------------------------------------------------------
# DF$Group: 1CS
# [1] 227.25
by(DF$HR,DF$Group,sd)
# DF$Group: 1AI
# [1] 30.93946
# -------------------------------------------------------------------------------------------------------------------------------------------------------------
# DF$Group: 1AS
# [1] 36.48551
# -------------------------------------------------------------------------------------------------------------------------------------------------------------
# DF$Group: 1CI
# [1] 23.25595
# -------------------------------------------------------------------------------------------------------------------------------------------------------------
# DF$Group: 1CS
# [1] 25.77236