Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upHow should `month()` behave when given an integer vector? #887
Comments
|
You are right. Let's throw an error for invalid months. |
month()has a (currently undocumented) feature where it can convert a numeric vector into an ordered factor of month names or abbreviations. If given invalid input, however, it produces undesirable results. Iflabel = Tthen the input values that are not integers from 1 to 12 return<NA>instead triggering an error. This might make someone think the value in question was missing rather than invalid. Not sure why anyone would do this, but iflabel = Fhowever, then the input values are just returned as output.Might be worth having a separate function to perform this operation, perhaps something like
fct_month()?Created on 2020-04-25 by the reprex package (v0.3.0)