Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在我的数据“DATA1”中,我试图计算变量“VAR”的平均值,并希望通过其他两个变量“MClas”和“SEX”对其进行分层。我已经尝试了以下代码,但它似乎不起作用。如何同时为两个分层修改它?
DATA1 %>% group_by(MClas & SEX) %>% summarise( n = n(), meanMT = mean(VAR, na.rm=T))