I am trying to get the mean age of males and females with various health conditions from my data frame.
AgeAnalyisi$Age num
AgeAnalyisi$Gout logical
AgeAnalyisi$Arthritis logical
AgeAnalyisi$Vasculitis logical
etc
AgeAnalysis$Gender Factor w/ 2 levels
I can get the mean age individually using
mean(AgeAnalysis$Age [AgeAnalysis$Gender=="M" & AgeAnalysis$Gout=="TRUE"] , na.rm = TRUE)
but is there a more eloquent way to pull it all together into one table, such that the output of mean age is presented as
Male Female
Gout x x
Arthritis x x
Vasculitis x x
etc x x
Thank you