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

tidy() gives a warning when used with anova() #487

Closed
AndrewKostandy opened this issue Aug 15, 2018 · 5 comments
Closed

tidy() gives a warning when used with anova() #487

AndrewKostandy opened this issue Aug 15, 2018 · 5 comments
Labels
bug an unexpected problem or unintended behavior

Comments

@AndrewKostandy
Copy link

AndrewKostandy commented Aug 15, 2018

After the latest broom update (0.5.0), the tidy function gives the warning: "Warning: Unknown or uninitialised column: 'term'." when used on the anova function. That was not the case before the update.

m1 <- lm(mpg~hp, data=mtcars)
m2 <- lm(mpg~hp+wt, data=mtcars)
broom::tidy(anova(m1,m2))
#> Warning: Unknown or uninitialised column: 'term'.
#> # A tibble: 2 x 6
#>   res.df   rss    df sumsq statistic     p.value
#> *  <dbl> <dbl> <dbl> <dbl>     <dbl>       <dbl>
#> 1     30  448.    NA   NA       NA   NA         
#> 2     29  195.     1  253.      37.6  0.00000112
@alexpghayes alexpghayes added the bug an unexpected problem or unintended behavior label Sep 4, 2018
@alexpghayes
Copy link
Collaborator

Hmmm, will look into this.

@topepo
Copy link
Member

topepo commented Jan 8, 2019

I get a similar issue when using one of the updater functions that has a column for AIC (but maybe a different issue)

# from ?drop1
require(graphics); require(utils); require(broom); require(dplyr)
#> Loading required package: broom
#> Loading required package: dplyr
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
## following example(swiss)
lm1 <- lm(Fertility ~ ., data = swiss)
add1(lm1, ~ I(Education^2) + .^2) %>% tidy()
#> Warning in tidy.anova(.): The following column names in ANOVA output were
#> not recognized or transformed: AIC
#> # A tibble: 12 x 5
#>    term                            df  sumsq   rss   AIC
#>    <chr>                        <dbl>  <dbl> <dbl> <dbl>
#>  1 <none>                          NA  NA    2105.  191.
#>  2 I(Education^2)                   1  11.8  2093.  192.
#>  3 Agriculture:Examination          1  10.7  2094.  192.
#>  4 Agriculture:Education            1   1.83 2103.  193.
#>  5 Agriculture:Catholic             1  75.0  2030.  191.
#>  6 Agriculture:Infant.Mortality     1   4.44 2101.  193.
#>  7 Examination:Education            1  48.7  2056.  192.
#>  8 Examination:Catholic             1  40.8  2064.  192.
#>  9 Examination:Infant.Mortality     1  65.9  2039.  191.
#> 10 Education:Catholic               1 278.   1827.  186.
#> 11 Education:Infant.Mortality       1  93.0  2012.  191.
#> 12 Catholic:Infant.Mortality        1   2.36 2103.  193.
drop1(lm1, test = "F")  %>% tidy()
#> Warning in tidy.anova(.): The following column names in ANOVA output were
#> not recognized or transformed: AIC
#> # A tibble: 6 x 7
#>   term                df  sumsq   rss   AIC statistic    p.value
#>   <chr>            <dbl>  <dbl> <dbl> <dbl>     <dbl>      <dbl>
#> 1 <none>              NA   NA   2105.  191.     NA    NA        
#> 2 Agriculture          1  308.  2413.  195.      5.99  0.0187   
#> 3 Examination          1   53.0 2158.  190.      1.03  0.315    
#> 4 Education            1 1163.  3268.  209.     22.6   0.0000243
#> 5 Catholic             1  448.  2553.  198.      8.72  0.00519  
#> 6 Infant.Mortality     1  409.  2514.  197.      7.96  0.00734

Created on 2019-01-07 by the reprex package (v0.2.1)

@brunaw
Copy link
Contributor

brunaw commented Jan 19, 2019

I claim this one

mattle24 pushed a commit to mattle24/broom that referenced this issue Mar 6, 2019
* fixing issue tidymodels#487: ANOVA warning

* fixe tidymodels#558: lmRob acceptance of conf.int

* removing unnecessary broom::
@tvatter
Copy link

tvatter commented Apr 9, 2020

I know that this is supposed to be fixed, but I actually get the exact same issue with broom version 0.5.5. Any idea what could be happening?

@github-actions
Copy link

github-actions bot commented Mar 9, 2021

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

5 participants