Open jennybc opened 7 years ago
Should this be in forcats? e.g. fac_mode()
.
For continuous variables it does not really make sense to get the sample mode, so it seems that this command is mostly about factors.
Should this be in forcats?
Given that fct_count()
is present in forcats, maybe fct_mode()
belongs there as well.
As for continuous variables, yes perhaps that is a road too far. And yet base commands like hist()
and density()
blithely make default choices for bins or bandwidth. There is precedent for simply making a good faith effort at such things. But, yes, I really was targeting the factor case here.
Also, how do you want to handle ties? Would it be better for Mode
to return a vector?
Mode of a categorical variable, in the statistical sense. I always feel embarrassed when I explain that R has no built-in way to compute the most frequent level of a factor. Here's one implementation from stackoverflow: