Skip to content
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

memisc::cases(): check.xor="ignore" not working for non-exhaustive #24

Closed
javrucebo opened this issue May 17, 2017 · 1 comment
Closed
Labels

Comments

@javrucebo
Copy link

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:

> 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):

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")
}
@melff melff added the bug label May 17, 2017
@melff
Copy link
Owner

melff commented Jul 2, 2017

Thanks for reporting this bug. Fixed as suggested in f882396

@melff melff closed this as completed Jul 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants