Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Describe Function in R (Setting precision digits)

I use the summary statistics of Describe function for my data in, but my results is:

> describe(rIND)
          vars    n mean    sd median trimmed   mad   min   max  range  skew
Adj.Close    1 1987    0  0.02      0       0  0.01 -0.12  0.16   0.28  0.27
          kurtosis se
Adj.Close     9.69  0

where rIND is a time series.

I try change the arguments of function using >describe(rIND, digits = 5) or other for change precision digits and see values of "median", "mean" etc.

I try use describe function of others libraries like Hmisc and lessR and don´t work.

how I can change it ?

I transform my data in a matrix and use describeBy. And the result is:

> class(rIND)
[1] "matrix"

> head(rIND)
        [,1]
[1,] 0.040867936
[2,] 0.001542679
[3,] 0.013143060
[4,] 0.016857574
[5,] 0.003183194
[6,] 0.001292192

> describeBy(rIND,mat=TRUE,digits=3)
Error in matrix(NaN, ncol = ncol, nrow = n.var * n.groups) : 
  value of 'nrow' not valid (very large or NA)
Warning message:
In describeBy(rIND, mat = TRUE, digits = 3) :
 no grouping variable requested
like image 823
FlávioCorinthians Avatar asked Oct 15 '25 04:10

FlávioCorinthians


1 Answers

You can use as.data.frame(describe(rIND)), which will use the digits parameter specified in your R options, and produce otherwise identical output to describe.

like image 123
Noah Avatar answered Oct 17 '25 17:10

Noah