I try to show the statistic summary of my data in table. my data looks like below:
Sex Cost Variance Numsample
M HC HV 7
M LC LV 9
....
F HC HV 4
F LC LV 3
...
As shown above, variable "Sex", "Cost" and "Variance" are all binary, specifically, Sex (M,F); Cost(HC,LC) and Variance (HV,LV). What I want to do here is to show the statistic summary (5 number summary) of Numsample for each group (e.g., 2 Cost X 2 Variance) by different Sex.
I only know how to show results by one group(variable) using tapply() or by() functions. and some others have similar question like this. But I think the result table for my quesion would be something looks like:
Sex:M
Cost - HC; Variance - HV
Min. 1st Qu. Median Mean 3rd Qu. Max.
Cost - LC; Variance - HV
Min. 1st Qu. Median Mean 3rd Qu. Max.
Cost - LC; Variance - LV
Min. 1st Qu. Median Mean 3rd Qu. Max.
Cost - HC; Variance - LV
Min. 1st Qu. Median Mean 3rd Qu. Max.
Sex:F
....(same as above)
Any ideas?