[R] How to return/show the indexes of unusual points in boxplot?

jim holtman jholtman at gmail.com
Wed Sep 9 22:31:28 CEST 2009


use 'match' to get the indices;

match(x$out, yourData)


On Wed, Sep 9, 2009 at 4:07 PM, <guox at ucalgary.ca> wrote:
> Thank you very much.
> But it seems that
> x$out returns the values not the indexes of the  values (1,22).
> -james
>
>> boxplot returns a dataframe that has the values in it at "$out":
>>
>>> x <- boxplot(c(4,rnorm(20),8))
>>> x
>> $stats
>>            [,1]
>> [1,] -1.5364498
>> [2,] -0.5282799
>> [3,] -0.1398736
>> [4,]  0.3065579
>> [5,]  1.3430388
>>
>> $n
>> [1] 22
>>
>> $conf
>>            [,1]
>> [1,] -0.4210947
>> [2,]  0.1413474
>>
>> $out
>> [1] 4 8
>>
>> $group
>> [1] 1 1
>>
>> $names
>> [1] "1"
>>
>>
>>
>> On Wed, Sep 9, 2009 at 3:25 PM, <guox at ucalgary.ca> wrote:
>>> I am wondering if you know how to return by function or show in
>>> boxplot,
>>> the indexes of unusual points, such as,
>>> points that are outside the box or in [Q3+1.5IQR,Max].
>>> For example,
>>>
>>>> boxplot(c(4,rnorm(20),8))
>>>
>>> There are 2 unusual points 4 and 8. How to show the indexes of 4 and 8
>>> in
>>> the boxplot
>>> or return them by function?
>>>
>>> Thanks,
>>>
>>> -james
>>>
>>> ______________________________________________
>>> R-help at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>
>>
>>
>> --
>> Jim Holtman
>> Cincinnati, OH
>> +1 513 646 9390
>>
>> What is the problem that you are trying to solve?
>>
>>
>>
>
>
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?




More information about the R-help mailing list