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.
level()
can handlelength(level) > 1
just fine, until one or more of the levels is not infct
, at which point the error message assumes thelevel
is actually of length 1 when forming the error message, and theif
clause will throw an error due to multiple logicals.Fix the error message and
if()
to handle thelength(level) > 1
case.