3

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

2 Answers2

2

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.

Noah
  • 3,437
  • 1
  • 11
  • 27
1

You can use describeBy for that. The command would be describeBy(rIND,group=NULL,mat=TRUE,type=3,digits=5). With 5 being set to whatever level of precision you need. As this only works when returning a matrix, you'll have to convert the matrix to a list of columns if you still want the list output.

See the full documentation for describe.by and you might check out the Quick-R reference guide if you have trouble finding the methods that exist for data manipulation.


Note: depending on your version of R, you may need to use describe.by() as the command.

LinkBerest
  • 1,281
  • 3
  • 22
  • 30
  • 1
    I try use describeBy and dont work. i received the message: `>In describeBy(rBRA, digits = 5) : no grouping variable requested` – FlávioCorinthians Jul 12 '15 at 03:27
  • 1
    don't work, result in `no grouping variable requested` again – FlávioCorinthians Jul 12 '15 at 03:38
  • @FlávioCorinthians Sorry, Forgot to set the matrix flag (change to `mat=TRUE`). As digit only works with a matrix. If you need to get a list after that you'll need to convert it. Note: if you want to get rid of the grouping error you just have to set one – LinkBerest Jul 12 '15 at 03:44