All, Consider the code below options(digits=2) x <- 1:1000 quantile(x, .975) The value returned is 975 (the 97.5th percentile), but the name has been shortened to "98%" due to the digits option. Is this intended? I would have expected the name to also be "97.5%" here. Alternatively, the returned value might be 980 in order to match the name of "98%". Best, Ed [[alternative HTML version deleted]]
Hi Edgar, I certainly don't think quantile(x, .975) should return 980, as that is a completely wrong answer. I do agree that it seems like the name is a bit offputting. I'm not sure how deep in the machinery you'd have to go to get digits to no effect on the names (I don't have time to dig in right this second). On the other hand, though, if we're going to make the names not respect digits entirely, what do we do when someone does quantile(x, 1/3)? That'd be a bad time had by all without digits coming to the rescue, i think. Best, ~G On Mon, Dec 14, 2020 at 11:55 AM Merkle, Edgar C. <merklee at missouri.edu> wrote:> All, > > Consider the code below > > options(digits=2) > x <- 1:1000 > quantile(x, .975) > > The value returned is 975 (the 97.5th percentile), but the name has been > shortened to "98%" due to the digits option. Is this intended? I would have > expected the name to also be "97.5%" here. Alternatively, the returned > value might be 980 in order to match the name of "98%". > > Best, > Ed > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >[[alternative HTML version deleted]]
The "value" is *not* 975. It's 975.025. The results that you're observing, are merely the byproduct of formatting. Maybe, you should try: quantile (x, .975, type=4) Which perhaps, using default options, produces the result you're expecting? On Tue, Dec 15, 2020 at 8:55 AM Merkle, Edgar C. <merklee at missouri.edu> wrote:> > All, > > Consider the code below > > options(digits=2) > x <- 1:1000 > quantile(x, .975) > > The value returned is 975 (the 97.5th percentile), but the name has been shortened to "98%" due to the digits option. Is this intended? I would have expected the name to also be "97.5%" here. Alternatively, the returned value might be 980 in order to match the name of "98%". > > Best, > Ed > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel