[Rd] quantile() type 1 for some ordered factors in R-devel

Tobias Rockel rocke|@to @end|ng |rom gm@||@com
Mon May 18 18:23:13 CEST 2020


Hi,

In R-devel (2020-05-17 r78478) quantile() type 1 seems to behave a little
bit strange for some ordered factors:
quantile(factor(1:3, ordered = TRUE), 0.5, type = 1)
returns “2” as expected. But
quantile(factor(2:4, ordered = TRUE), 0.5, type = 1)
returns “4” and
quantile(factor(3:5, ordered = TRUE), 0.5, type = 1)
returns “NA”. Furthermore, the function returns “NA” for calls like
quantile(factor(c("a", "b", "c"), ordered = TRUE), 0.5, type = 1)

In R 4.0.0 everything seems fine (return values “2”, “3”, “4”, “b”). If the
vectors are treated as numeric, everything seems to work fine in R-devel,
too. For example
quantile(3:5, 0.5, type = 1)
returns “4” in R-devel and R 4.0.0.

Best regards,
Tobias Rockel

	[[alternative HTML version deleted]]



More information about the R-devel mailing list