{"action":"closed","issue":{"url":"https://api.github.com/repos/markmfredrickson/optmatch/issues/82","labels_url":"https://api.github.com/repos/markmfredrickson/optmatch/issues/82/labels{/name}","comments_url":"https://api.github.com/repos/markmfredrickson/optmatch/issues/82/comments","events_url":"https://api.github.com/repos/markmfredrickson/optmatch/issues/82/events","html_url":"https://github.com/markmfredrickson/optmatch/issues/82","id":38093200,"number":82,"title":"`match_on` should dispatch numeric method when it can't find its first argument","user":{"login":"benthestatistician","id":827606,"avatar_url":"https://avatars.githubusercontent.com/u/827606?v=3","gravatar_id":"","url":"https://api.github.com/users/benthestatistician","html_url":"https://github.com/benthestatistician","followers_url":"https://api.github.com/users/benthestatistician/followers","following_url":"https://api.github.com/users/benthestatistician/following{/other_user}","gists_url":"https://api.github.com/users/benthestatistician/gists{/gist_id}","starred_url":"https://api.github.com/users/benthestatistician/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benthestatistician/subscriptions","organizations_url":"https://api.github.com/users/benthestatistician/orgs","repos_url":"https://api.github.com/users/benthestatistician/repos","events_url":"https://api.github.com/users/benthestatistician/events{/privacy}","received_events_url":"https://api.github.com/users/benthestatistician/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/markmfredrickson/optmatch/labels/bug","name":"bug","color":"e10c02"}],"state":"closed","locked":false,"assignee":{"login":"nullsatz","id":2879874,"avatar_url":"https://avatars.githubusercontent.com/u/2879874?v=3","gravatar_id":"","url":"https://api.github.com/users/nullsatz","html_url":"https://github.com/nullsatz","followers_url":"https://api.github.com/users/nullsatz/followers","following_url":"https://api.github.com/users/nullsatz/following{/other_user}","gists_url":"https://api.github.com/users/nullsatz/gists{/gist_id}","starred_url":"https://api.github.com/users/nullsatz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nullsatz/subscriptions","organizations_url":"https://api.github.com/users/nullsatz/orgs","repos_url":"https://api.github.com/users/nullsatz/repos","events_url":"https://api.github.com/users/nullsatz/events{/privacy}","received_events_url":"https://api.github.com/users/nullsatz/received_events","type":"User","site_admin":false},"milestone":null,"comments":13,"created_at":"2014-07-17T15:25:53Z","updated_at":"2015-04-07T00:36:34Z","closed_at":"2015-04-07T00:36:34Z","body":"We had a report from a user who was trying to get code along these lines to work:\r\n```\r\ndata(nuclearplants)\r\nd1 = match_on(cap, z=pr, data=nuclearplants)\r\n```\r\nBecause `match_on` can't find `cap` at the moment it has to dispatch, this fails and throws an error (\"Error in match_on<...>: object 'cap' not found\").  \r\n\r\nThe premise of the issue title is that we can fix this problem, without causing others, by dispatching to the numeric method in this situation.  I can't think of a scenario where one of the other `match_on` methods (for bigglm's, formulas, functions, glms, InfinitySparseMatrix-es, or matrix-es) would want to look inside of the `data` argument to find its first argument, so it seems OK to let the numeric method handle this situation.  If you see unwanted side effects that I'm missing, do speak up. \r\n\r\nIf we do handle the problem as I'm proposing to do, `match_on.numeric` should get a new error check at the top, to informatively identify the situation when the first argument just isn't to be found anywhere (perhaps because it was mistyped).  "}}