Why doesn't base R have a function for mode?

I was just thinking of calculating the mode for something, and I remembered that base R doesn't have a function for calculating the mode.

Is there a reason why?

I know there's a function base::mode() that is totally unrelated to the statistical mode, so the statistical mode would need a different function name, but that doesn't seem like it would be such a big issue.

2 Likes

I'm not sure, @eoppe1022! But here's an implementation of the statistical mode that seems pretty robust:

Yeah I was looking at that earlier, @rensa. Looks like a great solution. Though I'm still surprised there isn't a pre-built function for it.

3 Likes

That has puzzled me as well, it's such a basic thing. Still better than standard SQL which doesn't have median :).

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.