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

mod_eval doesn't work for models of form y ~ 1 #11

Open
dtkaplan opened this issue Mar 19, 2018 · 1 comment
Open

mod_eval doesn't work for models of form y ~ 1 #11

dtkaplan opened this issue Mar 19, 2018 · 1 comment

Comments

@dtkaplan
Copy link
Contributor

> lm(hp ~ 1, data = mtcars) -> mod
> mod_eval(mod)

Error in abs(n) : non-numeric argument to mathematical function

> mod_eval(mod, nlevels = 1)

Error in abs(n) : non-numeric argument to mathematical function

@rpruim
Copy link
Contributor

rpruim commented Jun 23, 2018

It looks like you did something to handle these cases.

Should we

(a) drop the null_model_input column before returning the results?
(b) run the output through distinct() so that we never return duplicated rows? [Can that happen now?]

library(mosaicModel)
#> Loading required package: mosaicCore
#> Loading required package: splines
#> Loading required package: magrittr
model <- lm(hp ~ 1, data = mtcars) 
mod_eval(model)
#> # A tibble: 1 x 2
#>   null_model_input model_output
#>   <lgl>                   <dbl>
#> 1 NA                       147.
mod_eval(model, nlevels = 1)
#> # A tibble: 1 x 2
#>   null_model_input model_output
#>   <lgl>                   <dbl>
#> 1 NA                       147.

Created on 2018-06-22 by the reprex package (v0.2.0).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants