这是我的意思
media<-by(df_02$score,df_02$sex,mean)
df_02$sex: female
[1] 3.01735
------------------------------------------------------------
df_02$sex: male
[1] 3.069552
现在我必须使用这些数据来计算相同的意思 1)VARIABLE etacat IS
etacat<-cutpoints(df_02$age,c(15,24,34,44,54,64,74,99),destra=TRUE) AND IT CREATES DIFFERENT RANGES OF AGE
by(df_02$score,list(df_02$sex,etacat),mean)
: female
: [15,24]
[1] 3.080624
: male
: [15,24]
[1] 3.140878
: female
: (24,34]
[1] 3.009594
: male
: (24,34]
[1] 3.100227
: female
: (34,44]
[1] 3.04165
: male
: (34,44]
[1] 3.117666
: female
: (44,54]
[1] 3.042544
: male
: (44,54]
[1] 3.092662
: female
: (54,64]
[1] 2.962814
: male
: (54,64]
[1] 3.021457
: female
: (64,74]
[1] 2.93885
: male
: (64,74]
[1] 2.849298
: female
: (74,99]
[1] 2.802057
: male
: (74,99]
[1] 2.755885
2)与性别相关的每个年龄段的观察数量
table(df_02$sex,etacat)
[15,24] (24,34] (34,44] (44,54] (54,64] (64,74] (74,99]
female 4216 5354 4743 3748 2743 1671 716
male 3997 5093 4495 3734 2720 1788 699
我如何解决这个问题?