Reputation: 409
I need a "describe" function that reports values with more than two decimal places and so I thought I would use the Hmisc describe function but even when using the sample code from http://www.inside-r.org/packages/cran/Hmisc/docs/describe I get an error:
> dfr <- data.frame(x=rnorm(400),y=sample(c('male','female'),400,TRUE))
> Hmisc::describe(dfr)
Error in UseMethod("describe") :
no applicable method for 'describe' applied to an object of class "data.frame"
> psych::describe(dfr)
vars n mean sd median trimmed mad min max range skew kurtosis se
x 1 400 0.07 0.96 0.07 0.07 0.94 -2.41 2.76 5.17 0.02 -0.3 0.05
y* 2 400 1.50 0.50 2.00 1.50 0.00 1.00 2.00 1.00 -0.01 -2.0 0.03
Any suggestions as to why it should be doing this?
Upvotes: 1
Views: 2547
Reputation: 2230
You are trying to use describe
in a way that is not supported. Just use:
require(Hmisc) # or library(Hmisc)
describe(mydataframe)
To get even better output install LaTeX and run
latex(describe(mydataframe), file='')
# file='' to put LaTeX code inline as for knitr
Upvotes: 3