I have a data frame that consists of several factor columns say A, B, C, D, and 
E and several columns containing numerical data, say X1, X2, .... X10. I would 
like to create statistics of some of the numerical columns by some of the 
factor columns. For example,

Calculate the mean, min, and max of variables X1 and X7, by factors A, and E. 
The results should look like the table below:

Factor A Factor E     mean(X1) min(x1) max(X1) mean(X7) min(x7) max(X7) 
mean(X10) min(x10) max(X10)
A1        E1
A1        E2
A1        E3
A2        E1
A2        E2
A2        E3

I would like the results to be returned to a data frame or other object that I 
can write out using the write.csv function. I have looked at the summarize and 
numSummary functions but they do not appear to be flexible enough to do the 
above.

Any help would be appreciated,

Thanks

Bernard McGarvey
Director, Fort Myers Beach Lions Foundation, Inc.
Retired (Lilly Engineering Fellow).

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to