gavinsimpson / gratia

ggplot-based graphics and useful functions for GAMs fitted using the mgcv package
https://gavinsimpson.github.io/gratia/
Other
206 stars 28 forks source link

`level()` doesn't handle more than one level cleanly #321

Open gavinsimpson opened 9 hours ago

gavinsimpson commented 9 hours ago

level() can handle length(level) > 1 just fine, until one or more of the levels is not in fct, at which point the error message assumes the level is actually of length 1 when forming the error message, and the if clause will throw an error due to multiple logicals.

Fix the error message and if() to handle the length(level) > 1 case.