pastecs for useful descriptive stats

You can use base R and the stats package to get statistics you need about your data. But, woah, I just found pastecs. It has a weird name, but check out the results below. If you want to use pastecs you’ll need to install.package(“pastecs”) and library(pastecs) to access its functions.The function that you will use is stats.desc.

From a data.frame that looks like this:

foo bar bat
-59.7 -45.7 -15.6
-60.9 -38.1 -24.0
-61.2 -39.2 -12.1
-64.1 -36.0 -21.3

And this function call:

foo.stats <- stat.desc(foo, basic=TRUE, desc=TRUE, norm=TRUE, p=0.95)

You get all of this:

foo bar bat
nbr.val 4.0000000 4.0000000 4.0000000
nbr.null 0.0000000 0.0000000 0.0000000
nbr.na 0.0000000 0.0000000 0.0000000
min -64.1050000 -45.7010000 -23.98200000
max -59.7340000 -35.9820000 -12.15300000
range 4.3710000 9.7190000 11.82900000
sum -245.9660000 -159.0400000 -73.00600000
median -61.0635000 -38.6785000 -18.43550000
mean -61.4915000 -39.7600000 -18.25150000
SE.mean 0.9286446 2.0916702 2.68089365
CI.mean.0.95 2.9553615 6.6566281 8.53180008
var 3.4495230 17.5003367 28.74876300
std.dev 1.8572892 4.1833404 5.36178730
coef.var -0.0302040 -0.1052148 -0.29377242
skewness -0.4754708 -0.5167070 0.04817799
skew.2SE -0.2344103 -0.2547400 0.02375207
kurtosis -1.8164507 -1.8110083 -2.21497552
kurt.2SE -0.3468343 -0.3457951 -0.42292887
normtest.W 0.9066441 0.8965291 0.95487609
normtest.p 0.4648037 0.4140238 0.74667459

Leave a Reply