{"action":"created","issue":{"url":"https://api.github.com/repos/mlr-org/mlr/issues/2422","repository_url":"https://api.github.com/repos/mlr-org/mlr","labels_url":"https://api.github.com/repos/mlr-org/mlr/issues/2422/labels{/name}","comments_url":"https://api.github.com/repos/mlr-org/mlr/issues/2422/comments","events_url":"https://api.github.com/repos/mlr-org/mlr/issues/2422/events","html_url":"https://github.com/mlr-org/mlr/issues/2422","id":353467898,"node_id":"MDU6SXNzdWUzNTM0Njc4OTg=","number":2422,"title":"Error when predicting new dataset with single factor values","user":{"login":"mb1069","id":9156542,"node_id":"MDQ6VXNlcjkxNTY1NDI=","avatar_url":"https://avatars1.githubusercontent.com/u/9156542?v=4","gravatar_id":"","url":"https://api.github.com/users/mb1069","html_url":"https://github.com/mb1069","followers_url":"https://api.github.com/users/mb1069/followers","following_url":"https://api.github.com/users/mb1069/following{/other_user}","gists_url":"https://api.github.com/users/mb1069/gists{/gist_id}","starred_url":"https://api.github.com/users/mb1069/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mb1069/subscriptions","organizations_url":"https://api.github.com/users/mb1069/orgs","repos_url":"https://api.github.com/users/mb1069/repos","events_url":"https://api.github.com/users/mb1069/events{/privacy}","received_events_url":"https://api.github.com/users/mb1069/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-08-23T16:53:48Z","updated_at":"2018-08-23T20:17:08Z","closed_at":null,"author_association":"NONE","body":"Hi,\r\nI'm having some issue predicting new values from unseen data; this data comes from a single source, and therefore many of the factor-type columns have a single value in this new dataset. However, the original dataset has no constant columns.\r\n\r\nWhen running predict, I am getting the following error:\r\n```R\r\nError in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) : \r\n  contrasts can be applied only to factors with 2 or more levels\r\n```\r\nA minimum example can be found with data here:\r\n[min_example.tar.gz](https://github.com/mlr-org/mlr/files/2315420/min_example.tar.gz)\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/mlr-org/mlr/issues/comments/415557237","html_url":"https://github.com/mlr-org/mlr/issues/2422#issuecomment-415557237","issue_url":"https://api.github.com/repos/mlr-org/mlr/issues/2422","id":415557237,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNTU1NzIzNw==","user":{"login":"larskotthoff","id":579233,"node_id":"MDQ6VXNlcjU3OTIzMw==","avatar_url":"https://avatars2.githubusercontent.com/u/579233?v=4","gravatar_id":"","url":"https://api.github.com/users/larskotthoff","html_url":"https://github.com/larskotthoff","followers_url":"https://api.github.com/users/larskotthoff/followers","following_url":"https://api.github.com/users/larskotthoff/following{/other_user}","gists_url":"https://api.github.com/users/larskotthoff/gists{/gist_id}","starred_url":"https://api.github.com/users/larskotthoff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/larskotthoff/subscriptions","organizations_url":"https://api.github.com/users/larskotthoff/orgs","repos_url":"https://api.github.com/users/larskotthoff/repos","events_url":"https://api.github.com/users/larskotthoff/events{/privacy}","received_events_url":"https://api.github.com/users/larskotthoff/received_events","type":"User","site_admin":false},"created_at":"2018-08-23T20:17:08Z","updated_at":"2018-08-23T20:17:08Z","author_association":"CONTRIBUTOR","body":"The problem isn't with the prediction, it's with the dummy features wrapper, which assumes that factors have at least 2 levels (otherwise a dummy encoding doesn't make sense)."}}
{"actor":{"display_login":"larskotthoff"}}