Restructure output of R summary function
Posted emanlee
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Restructure output of R summary function相关的知识,希望对你有一定的参考价值。
Treat it as a data.frame:
set.seed(1)
x <- sample(30, 100, TRUE)
summary(x)
# Min. 1st Qu. Median Mean 3rd Qu. Max.
# 1.00 10.00 15.00 16.03 23.25 30.00
summary(data.frame(x))
# x
# Min. : 1.00
# 1st Qu.:10.00
# Median :15.00
# Mean :16.03
# 3rd Qu.:23.25
# Max. :30.00
For slightly more usable output, you can use data.frame(unclass(.)):
val = data.frame(unclass(summary(x)))
val
# val
# Min. 1.00
# 1st Qu. 10.00
# Median 15.00
# Mean 16.03
# 3rd Qu. 23.25
# Max. 30.00
val[1,1]
val[2,1]
val[3,1]
Or you can use stack:
stack(summary(x))
# values ind
# 1 1.00 Min.
# 2 10.00 1st Qu.
# 3 15.00 Median
# 4 16.03 Mean
# 5 23.25 3rd Qu.
# 6 30.00 Max.
Ref:
https://stackoverflow.com/questions/27715934/restructure-output-of-r-summary-function
以上是关于Restructure output of R summary function的主要内容,如果未能解决你的问题,请参考以下文章
R假设检验之Bartlett球形检验(Bartlett’s Test of Sphericity)
A Newbie’s Install of Keras & Tensorflow on Windows 10 with R
求助abap 编程:ASSIGN COMPONENT ld_index OF STRUCTURE t_output TO <fs>.这句要怎么理解呢?