展开r

时间:2019-12-13 23:16:48

标签: r statistics

美好的一天,

我有一个表,其中包含15000行数据和5个可变列。我在R中使用摘要功能,并得到以下输出:

enter image description here

那很好,但是,我想知道是否有任何方法可以扩展它以包括标准偏差以及0.025和0.975分位数,因此最终表将如下所示,

enter image description here

非常感谢。

2 个答案:

答案 0 :(得分:0)

由于R中的所有功能都是开源的,因此您可以对其进行编辑以执行所需的任何操作。简而言之,最简单的解决方案是在R包中找到另一个更接近您想要的描述性统计功能。有很多选择,但是非常接近您想要的一种是numSummary()软件包中的RcmdrMisc

library(RcmdrMisc)
data(iris)
options(digits=4)
numSummary(iris[, 1:4], statistics=c("mean", "sd", "quantiles"), 
      quantiles=c(.025, .5, .975))
#               mean     sd  2.5%  50% 97.5%   n
# Sepal.Length 5.843 0.8281 4.473 5.80 7.700 150
# Sepal.Width  3.057 0.4359 2.272 3.00 3.928 150
# Petal.Length 3.758 1.7653 1.272 4.35 6.455 150
# Petal.Width  1.199 0.7622 0.100 1.30 2.400 150

答案 1 :(得分:0)

使用RcmdrMisc软件包就像灵符一样工作

enter image description here

谢谢你dcarlson