New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
date_breaks and date_breaks minor don't check argument type #5880
Comments
Thanks for the report! If this is a request for better messages, it is probably better to appeal to {scales} to improve the message. ggplot2 has little control over the messages the packages it depend on throw. |
I would like better messages, but I think the best way of doing that would be to check that the inputs received by the function are the correct type (as stated by function documentation), instead of passing them blindly to other functions unknown. In this case, it's because I passed a function to the wrong breaks parameter ( |
datetime_scales
accepts any argument type fordate_breaks
anddate_minor_breaks
, but the parameter documentation claims it only accepts character strings. It's somewhat easy to accidentally supply custom date breaks usingscales::breaks_width
to the wrong parameter (date_breaks
instead ofbreaks
), after all, you're defining date-breaks either way.I expected an error that the date_breaks parameter had the wrong type, instead I got the unhelpful:
Error in strsplit(unitspec, " ") : non-character argument
.The text was updated successfully, but these errors were encountered: