Bug 17438 - 3rd Quantile
Summary: 3rd Quantile
Status: CLOSED FIXED
Alias: None
Product: R
Classification: Unclassified
Component: Wishlist (show other bugs)
Version: R 3.5.0
Hardware: x86_64/x64/amd64 (64-bit) Other
: P5 enhancement
Assignee: R-core
URL:
Depends on:
Blocks:
 
Reported: 2018-06-25 06:22 UTC by melgoussi@gmail.com
Modified: 2018-07-21 16:00 UTC (History)
2 users (show)

See Also:


Attachments
proof of concept for customizing the quantile type (828 bytes, patch)
2018-07-03 14:24 UTC, Benjamin Tyner
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description melgoussi@gmail.com 2018-06-25 06:22:37 UTC
Dear Mr. 
3rd Qu. should be (14+16)/2 = 15 not 14.5 ......


x <- sort(c(4, 17, 7, 14, 18, 12, 3, 16, 10, 4, 4, 11))
summary(x)

 Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
    3.0     4.0    10.5    10.0    14.5    18.0
Comment 1 Benjamin Tyner 2018-06-25 22:08:49 UTC
The default in S and R is to return the quantile of type 7. It sounds like you may be looking for the type 2 quantile instead? If so, use:

> quantile(x, 0.75, type = 2)
75% 
 15
Comment 2 melgoussi@gmail.com 2018-06-26 10:29:05 UTC
why summary function is not accepting an argument of type = 2?

> summary(x)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
    3.0     4.0    10.5    10.0    14.5    18.0 

> summary(x, type = 2)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
    3.0     4.0    10.5    10.0    14.5    18.0
Comment 3 Benjamin Tyner 2018-07-03 14:24:50 UTC
Created attachment 2353 [details]
proof of concept for customizing the quantile type

melgoussi: it sounds like you are requesting a new feature. Here is one way to skin the cat...
Comment 4 Martin Maechler 2018-07-21 16:00:37 UTC
(In reply to Benjamin Tyner from comment #3)
> Created attachment 2353 [details]
> proof of concept for customizing the quantile type
> 
> melgoussi: it sounds like you are requesting a new feature. Here is one way
> to skin the cat...

indeed, and the corresponding changes to the docs..  all hardly worth it, but then ....  committed to the sources in svn r 74997.