IN r, how to combine the summary together

后端 未结 2 1302
鱼传尺愫
鱼传尺愫 2021-02-09 04:34

say i have 5 summary for 5 sets of data. how can i get those number out or combine the summary in to 1 rather than 5

       V1               V2               V3          


        
2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-09 04:55

    It looks like your data is in a data frame or matrix. If so, you can do the following:

    > df <- data.frame(a=1:50, b=3:52, c=rnorm(500))
    > apply(df, 2, summary)
               a    b         c
    Min.     1.0  3.0 -3.724000
    1st Qu. 13.0 15.0 -0.733000
    Median  25.5 27.5 -0.004868
    Mean    25.5 27.5 -0.033950
    3rd Qu. 38.0 40.0  0.580800
    Max.    50.0 52.0  2.844000
    

提交回复
热议问题