Simplifying summary statistic output stratified by a categorical variable in R -


program being used

i using statistical program r analyze data , have simple question.

background problem

i have variable full of numeric values called study_data$ln_reviewed. have variable called study_data$gender has sex of each subject in study. compute simple summary statistics stratified gender. easy using code shown below:

> by(study_data$ln_reviewed, study_data$gender, summary)  study_data$gender: female min. 1st qu.  median    mean 3rd qu.    max.  

2.00 13.00 19.00 27.77 35.50 125.00

study_data$gender: male min. 1st qu. median mean 3rd qu. max. 1.00 12.00 19.00 26.98 34.00 122.00

my question

how can r display information in easier digest format? specifically, table has 2 rows, entitled "female" , "male", , 6 columns, entitled "min.", "1st qu.", "median", "mean", "3rd qu.", , "max.", shown below.

       min. 1st qu.  median    mean 3rd qu.    max. female 2.00   13.00   19.00   27.77   35.50  125.00 male   1.00   12.00   19.00   26.98   34.00  122.00 

i have spent time trying solve on own , have been unable find solution.

do.call(rbind , by(study_data$ln_reviewed, study_data$gender, summary))


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -