Reputation: 307
Good day,
I've got a table with 15000 rows of data with 5 variable columns. I'm using the summary function in R and I get the following output:
Which is fine, however, I was wondering if there was any way to either expand this to include the standard deviation and the 0.025 and 0.975 quantiles so the final table would appear as follows,
Many thanks.
Upvotes: 1
Views: 813
Reputation: 307
Worked like a charm using the RcmdrMisc package,
Thank you dcarlson
Upvotes: 0
Reputation: 11056
Since all functions in R are open source, you can edit them to do whatever you want. Short of that, the simplest solution is to find another descriptive statistics function in an R package that is closer to what you want. There are many options, but one that comes very close to what you want is numSummary()
in the RcmdrMisc
package:
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
Upvotes: 2