IN r, how to combine the summary together

后端 未结 2 1312
鱼传尺愫
鱼传尺愫 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:57

    You can convert the summary output into a matrix and then bind them:

    a <- 1:50
    b <- 3:53 
    c <- rnorm(500)
    cbind(as.matrix(summary(a)), as.matrix(summary(b)), as.matrix(summary(c)))
    

    Alternatively, you can combine them into a list and use an apply function (or plyr):

    library(plyr)
    ldply(list(a, b, c), summary)
    

提交回复
热议问题