{"action":"created","issue":{"url":"https://api.github.com/repos/dgrtwo/broom/issues/62","labels_url":"https://api.github.com/repos/dgrtwo/broom/issues/62/labels{/name}","comments_url":"https://api.github.com/repos/dgrtwo/broom/issues/62/comments","events_url":"https://api.github.com/repos/dgrtwo/broom/issues/62/events","html_url":"https://github.com/dgrtwo/broom/issues/62","id":96883039,"number":62,"title":"tidy method for anova misses a column name","user":{"login":"agoldst","id":1249780,"avatar_url":"https://avatars.githubusercontent.com/u/1249780?v=3","gravatar_id":"","url":"https://api.github.com/users/agoldst","html_url":"https://github.com/agoldst","followers_url":"https://api.github.com/users/agoldst/followers","following_url":"https://api.github.com/users/agoldst/following{/other_user}","gists_url":"https://api.github.com/users/agoldst/gists{/gist_id}","starred_url":"https://api.github.com/users/agoldst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agoldst/subscriptions","organizations_url":"https://api.github.com/users/agoldst/orgs","repos_url":"https://api.github.com/users/agoldst/repos","events_url":"https://api.github.com/users/agoldst/events{/privacy}","received_events_url":"https://api.github.com/users/agoldst/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-23T18:57:09Z","updated_at":"2015-07-24T12:42:14Z","closed_at":null,"body":"Applying `tidy` to the results of `anova` on more than one model yields a data frame where all the column names are off by one (and the last column has name `NA`):\r\n\r\n```r\r\nm1 <- lm(mpg ~ wt + qsec + disp, mtcars)\r\nm2 <- lm(mpg ~ wt, mtcars)\r\na <- anova(m1, m2)\r\n```\r\n\r\nNow `print(a)` gives\r\n\r\n````\r\nAnalysis of Variance Table\r\n\r\nModel 1: mpg ~ wt + qsec + disp\r\nModel 2: mpg ~ wt\r\n  Res.Df    RSS Df Sum of Sq      F   Pr(>F)   \r\n1     28 195.46                                \r\n2     30 278.32 -2   -82.859 5.9348 0.007099 **\r\n---\r\nSignif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1\r\n````\r\n\r\nbut `tidy(a)` gives\r\n\r\n````\r\n  df    sumsq meansq statistic  p.value          NA\r\n1 28 195.4626     NA        NA       NA          NA\r\n2 30 278.3219     -2 -82.85933 5.934796 0.007099496\r\n````\r\n\r\nIt looks like `tidy.anova` assumes `a` has five columns, but it has six; the method misses the third column of `a` (the `Df` column). Apologies for not putting together a pull request, and thanks for this fantastic package."},"comment":{"url":"https://api.github.com/repos/dgrtwo/broom/issues/comments/124507512","html_url":"https://github.com/dgrtwo/broom/issues/62#issuecomment-124507512","issue_url":"https://api.github.com/repos/dgrtwo/broom/issues/62","id":124507512,"user":{"login":"nutterb","id":1848445,"avatar_url":"https://avatars.githubusercontent.com/u/1848445?v=3","gravatar_id":"","url":"https://api.github.com/users/nutterb","html_url":"https://github.com/nutterb","followers_url":"https://api.github.com/users/nutterb/followers","following_url":"https://api.github.com/users/nutterb/following{/other_user}","gists_url":"https://api.github.com/users/nutterb/gists{/gist_id}","starred_url":"https://api.github.com/users/nutterb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nutterb/subscriptions","organizations_url":"https://api.github.com/users/nutterb/orgs","repos_url":"https://api.github.com/users/nutterb/repos","events_url":"https://api.github.com/users/nutterb/events{/privacy}","received_events_url":"https://api.github.com/users/nutterb/received_events","type":"User","site_admin":false},"created_at":"2015-07-24T12:42:14Z","updated_at":"2015-07-24T12:42:14Z","body":"This is another type of ANOVA, and is really more of a likelihood ratio test than an analysis of variance.  \r\n\r\nBut this can be resolved as easily as adding another `else if{}`\r\n\r\n```r\r\nelse if (identical(colnames(x), c(\"Res.Df\", \"RSS\", \"Df\", \"Sum of Sq\", \"F\", \"Pr(>F)\"))){\r\n    # x is anova(m1, m2)\r\n    nn <- c(\"res.df\", \"rss\", \"df\", \"sumsq\", \"statistic\", \"p.value\")\r\n  }\r\n```"}}