[R] A question about list

David Winsemius dwinsemius at comcast.net
Fri Mar 18 03:15:34 CET 2011


On Mar 17, 2011, at 5:44 PM, ufuk beyaztas wrote:

> Hi dear all,
>
> It may be a simple question, i have a list output with different  
> number of
> elements as following;
>
> [[1]]
> [1]  0.86801402 -0.82974691  0.39746666 -0.98566707 -4.96576856  
> -1.32056754
> [7] -5.54093319 -0.07600462 -1.34457280 -1.04080125  1.62843297  
> -0.20473912
> [13]  0.30659907  2.66908117  2.53791837  0.53788013 -0.57463077   
> 0.27708874
> [19] -2.94233200  1.54565643 -6.83694100  7.21556266 -3.14823536  
> -1.34590796
> [25]  0.78660855  5.53692735  1.22511890  7.65249980 -0.43008997  
> -0.10536125
>
> [[2]]
> [1] -2.80332826  0.54414548  4.38232256 -1.38407653 -1.59241491  
> -1.35509664
> [7]  1.04806755 -0.27685465 -1.36671548 -3.16649719  2.17194692  
> -3.49404253
> [13]  4.69102017  2.78297615  0.34565006  1.05954751  1.78836097  
> -0.80393182
> [19]  3.74315304  1.17427902  1.62354686  0.53186688 -6.56519965  
> -3.39045485
> [25]  0.01043676 -0.18857654 -0.57070351 -0.06135564  6.92331269  
> -1.46544614
> [31] -1.65309767
>
> [[3]]
> [1]  4.1923546  0.6319591 -0.8568113 -3.3115788 -2.4166481 -1.1543074
> [7] -0.9333245  0.2632038 -0.6909956 -3.1008763 -2.9557687  1.5382464
> [13]  1.2713290  6.6527302  1.0433603 -0.9916190 -2.7724673 -1.6554250
> [19]  1.8023591 -1.5101793  1.2604704 -0.2853326 -2.4312827 -0.4731487
> [25]  3.5061061  1.7392190  1.5493419 -0.7203778 -0.6995221  2.7686406
> [31]  6.1813364 -1.8665294
>
> I want to compute the percentile of all of 94 elements, i tried
> quantile(data) but i got an error like
> Error in sort.list(x, partial = unique(c(lo, hi))) :
>  'x' must be atomic for 'sort.list'
> Have you called 'sort' on a list?
> Can some one help me abouth this ?
> Thanks for any idea...

I don't know if quantile has a default for probs but if it does then  
try:

quantile( unlist(mylist) )   # untested.

-- 

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list