Skip to content

informative error on impossible matches #226

@josherrickson

Description

@josherrickson

In the past, if a user tried to pass something impossible (e.g. pairmatch(pr ~ cost, controls = 100, data = nuclearplants)), they'd get the following:

## Error in pairmatch.matrix(m, controls = controls, data = mfd,
##   remove.unmatchables = remove.unmatchables, : not enough
##   controls in some subclasses

(Taken from some old slides that I'm in the process of updating.)

Now, the same code produces:

## Error in fullmatch.matrix(x = x, min.controls = controls, 
##    max.controls = controls, : negative 'omit.fraction' with
##    'min.controls' >= 2 not permitted

The former was much more clear to end-users. I get they say the same thing, but a user using e.g. pairmatch may not have any idea what omit.fraction or min.controls are.

I haven't looked into whether we've change the actual error, or (more likely) the order of operations has changed such that this second error gets hit earlier. Either way, I think we should try and catch this issue and error more informatively. Something like "The restrictions on the matched set sizes through controls/min.control/max.controls/omit.fraction are impossible to meet."

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions