Closed javrucebo closed 7 years ago
The help text for memisc::cases() states for the parameter check.xor: "checks, whether the case conditions are mutually exclusive and exhaustive".
check.xor
In case the conditions are not exhaustive check.xor="ignore" does not work. It does issue a warning:
check.xor="ignore"
> x <- c(1,2) > memisc::cases( + "1"=x==1, + "2"=x==2, + "3"=x==3, + check.xor="ignore" + ) [1] 1 2 Levels: 1 2 3 Warning message: In memisc::cases(`1` = x == 1, `2` = x == 2, `3` = x == 3, check.xor = "stop") : condition x == 3 is never satisfied
in cases.R one should probably change (similarly to the check for done):
cases.R
done
if(any(never) && check.xor!="ignore"){ msg <- switch(check.xor,warn=warning,stop=stop) neverlab <- deflabels[never] if(length(neverlab)==1) msg("condition ",neverlab," is never satisfied") else msg("conditions ",paste(neverlab,collapse=", ")," are never satisfied") }
Thanks for reporting this bug. Fixed as suggested in f88239608aa74fe5a5156efc1b20bf9f9e7b1706
The help text for memisc::cases() states for the parameter
check.xor
: "checks, whether the case conditions are mutually exclusive and exhaustive".In case the conditions are not exhaustive
check.xor="ignore"
does not work. It does issue a warning:in
cases.R
one should probably change (similarly to the check fordone
):