0

In my data 'DATA1', I am trying to calculate mean of the variable 'VAR' and want to stratify it by two other variables 'MClas' as well as 'SEX'. I have tried the following code but it doesn't seem to be working. How do I modify it for both stratifications at once?

DATA1 %>%
  group_by(MClas & SEX) %>%
  summarise(
    n = n(),
    meanMT = mean(VAR, na.rm=T))
Gregor Thomas
  • 136,190
  • 20
  • 167
  • 294
Tabbi
  • 69
  • 1
  • 9

0 Answers0