0
votes

I believe I might be using the quantile() function wrong inside an ore.groupApply() but cannot figure out what is going wrong. If I use median() instead everything works as I expect it to. But with quantile() I'm getting back a data structure that does not let me access the 5 individual numbers for each entry. Here is my R code:

quant_results <- ore.groupApply( endOfTestBuckets, 
                                 INDEX=endOfTestBuckets$compositeIndex,
                                 function(dat) {
                                   quantile( dat$TOTALCOUNT);
                                 }
                               );
return (ore.pull(quant_results));  

I am grouping based on the compositeIndex field, and calculating the quantile of the TOTALCOUNT field. I then pull the results from ORE into R. Here is an example:

quant_results  Large list (159173 elements...)
 100_1013382: Named num [1:5] 0 10 20 30 40
 .. - attr(*, "names")= chr [1:5] "0%" "25%" "50%" "75" ...
 etc.

I can get at the composite index find. For example, names( quant_results[1]) is "100_1013382". But no matter what I do, I cannot get at the numbers 0, 10, 20, 30 and 40. In fact, typeof( quant_results[1]) is a list, and length( quant_results[1]) is 1. And if I sub-index, such as [1][1] it does not help matters any.

As I said, if I use median() instead, then I can get to the median value of each entry. So I think the issue is with quantile() returning a list of numbers.

Any ideas? Thanks.

1

1 Answers

0
votes

Finally found it. You have to use an odd double-bracket notation. [[1]][[3]] for example gets you the median value (the third numeric) of the first entry.