Trying to output summary statistics using summarize from rockchalk package.
Want the stats to be rounded to 2 decimals. I get an error message when
using round on summarize.
library(rockchalk)
M1 <- structure(c(0.18, 0.2, 0.24, 0.35, -0.22, -0.17, 0.28, -0.28, -0.14, 0.03, 0.87, -0.2, 0.06, -0.1, -0.72, 0.18, 0.01, 0.31, -0.36, 0.61, -0.16, -0.07, -0.13, 0.01, -0.09, 0.26, -0.14, 0.08, -0.62, -0.2, 0.3, -0.21, -0.11, 0.05, 0.06, -0.28, -0.27, 0.17, 0.42, -0.05, -0.15, 0.05, -0.07, -0.22, -0.34, 0.16, 0.34, 0.1, -0.12, 0.24, 0.45, 0.37, 0.61, 0.9, -0.25, 0.02), .Dim = c(56L, 1L))
#This works
round(apply(M1, 2, mean),2)
#This works
summaryround <- function(x) {round(summary(x),2)}
apply(M1, 2, summaryround)
#This gives error "non-numeric argument"
round(apply(M1, 2, summarize),2)
#Thought this would work but also gives error "non-numeric argument"
summarizeround <- function(x) {round(summarize(x),2)}
apply(M1, 2, summarizeround)
Any ideas? I can round the output of summary but want to use summarize
if possible as I like to get the outputs of kurtosis and skewness in the same printout (of course, could create my own function combining summary and kurtosis and whatever I want, rather not if avoidable).
EDIT: should have mentioned actually running this on a large data frame; turned it into a 1 column matrix as I thought would make the reproducible example simpler.